def read_class_path(class_path):
    '''Cache content of all jars.
    Begin with rt.jar
    '''

    # folders for lookup for class files
    lookup_paths = []
    # content of all jars (name->path to jar)
    jars = {}
    # content of rt.jar
    rt = {}

    # first check local rt.jar
    local_path = os.path.dirname(os.path.realpath(__file__))
    RT_JAR = os.path.join(local_path, "../rt/rt.jar")
    if not os.path.isfile(RT_JAR):
        JAVA_HOME = os.environ.get('JAVA_HOME')
        if JAVA_HOME is None:
            raise Exception("JAVA_HOME is not set")
        if not os.path.isdir(JAVA_HOME):
            raise Exception("JAVA_HOME must be a folder: %s" % JAVA_HOME)

        RT_JAR = os.path.join(JAVA_HOME, "lib/rt.jar")
        if not os.path.exists(RT_JAR) or os.path.isdir(RT_JAR):
            RT_JAR = os.path.join(JAVA_HOME, "jre/lib/rt.jar")
            if not os.path.exists(RT_JAR) or os.path.isdir(RT_JAR):
                raise Exception("rt.jar not found")

    if not zipfile.is_zipfile(RT_JAR):
        raise Exception("rt.jar is not a zip: %s" % RT_JAR)

    read_from_jar(RT_JAR, rt)

    current = os.getcwd()

    splitter = None
    if ":" in class_path:
        splitter = ":"
    elif ";" in class_path:
        splitter = ";"
    elif "," in class_path:
        splitter = ","
    else:
        splitter = ":"
    cpaths = class_path.split(splitter)
    for p in cpaths:
        p = p.strip()
        path = os.path.join(current, p)
        if not os.path.exists(path):
            raise Exception("Wrong class path entry: %s (path not found %s)",
                            p, path)
        if os.path.isdir(path):
            lookup_paths.append(path)
        else:
            if zipfile.is_zipfile(path):
                read_from_jar(path, jars)
            else:
                raise Exception("Class path entry %s is not a jar file" % path)

    return (lookup_paths, jars, rt)