[Soot-list] JDK Support and Soot's Classpath Setting

Liu Yuan liuyuan at fastmail.com
Thu Mar 11 19:19:23 EST 2021


Hi, I have JDK16 installed, and using the following to create a CFG.

But I get an exception Unsupported class file major version 60, for SootClass appclass = Scene.v().loadClassAndSupport(mainClass);

I think soot can run in JDK 16, so the reason is that the class files to be analyzed is compied at a high JDK version.

So is there any method to solve it? If not, what is the supported scope of the JDK compiled version for the class files? 

Besides, JDK 9+ remove the rt.jar and ice.jar. After searching, I learned that I only need to set prepend_classpat to load the necessary classes for soot to run. I don't know if it is correct. 

Any suggestion is appreciated, thank you.

public static void main(String[] args) {

        String classesDir = "./input/dataset/tracker-server.jar";
        String mainClass = "org.traccar.Main";
        TypeReferenceSequencesSolver analysis = new TypeReferenceSequencesSolver();
        Options.v().set_prepend_classpath(true);
        PackManager.v().getPack("wjtp").add(new Transform("wjtp.TypeReferenceSequencesSolver", analysis));

        Options.v().set_process_dir(Arrays.asList(classesDir));
        Options.v().set_whole_program(false);
        Options.v().setPhaseOption("jb", "preserve-source-annotations:true");
        Options.v().setPhaseOption("jj", "use-original-names:true");
        Options.v().set_keep_line_number(true);

        SootClass appclass = Scene.v().loadClassAndSupport(mainClass);
        Scene.v().setMainClass(appclass);
        Scene.v().loadNecessaryClasses();

        PackManager.v().runPacks();
    }

Best,
Yuan


More information about the Soot-list mailing list