[Soot-list] Beginner's question: Making tutorial/guide/examples/call_graph example work

Michal Young michal at cs.uoregon.edu
Thu Jan 3 21:24:01 EST 2008


> I'm not sure why the Soot class path doesn't seem to be getting  
> set, but
> you can definitely set it explicitly with a call to
> Scene.v().setSootClassPath(). You can also print it with
> getSootClassPath. Good luck!

Thanks.  When I add printing of the soot class path near the  
beginning of the example, the rt.jar library does appear to be there  
(in fact there's the one I put there explicitly, adding the -cp  
option after program name as suggested by William Benton, and another  
rt.jar with a somewhat different path.

So now the command line to run the program is ...

      bash-2.05$ java dk.brics.soot.callgraphs.CallGraphExample -cp  
$CLASSPATH

with CLASSPATH set to  (with newlines added for clarity)
    .:
     /home/faculty/michal/tools/soot/classes:
     /home/faculty/michal/tools/polyglot-1.3.4/classes:
     /home/faculty/michal/tools/jasmin-2708/classes:
     /home/faculty/michal/tools/polyglot-1.3.4/cup-classes:
     /usr/java/jre/lib/rt.jar

and with this debugging ...

...
public class CallGraphExample
{
         public static void main(String[] args) {
             System.out.println("Beginning main"); //DBG

                 // Add suggested by Patrick Lam:
                 System.out.println("Soot class path: "
                                    + Scene.v().getSootClassPath() );
                 // End of debugging


                 Options.v().set_whole_program(true);

             System.out.println("loadClassAndSupport --- "); //DBG
                 SootClass mainClass = Scene.v().loadClassAndSupport 
("testers.Ca\
llGraphs");
...

and this result:

bash-2.05$ java dk.brics.soot.callgraphs.CallGraphExample -cp $CLASSPATH
Beginning main
Soot class path: .:/home/faculty/michal/tools/soot/classes:/home/ 
faculty/michal/tools/polyglot-1.3.4/classes:/home/faculty/michal/ 
tools/jasmin-2708/classes:/home/faculty/michal/tools/polyglot-1.3.4/ 
cup-classes:/usr/java/jre/lib/rt.jar:/usr/j2se/jre/lib/rt.jar
loadClassAndSupport ---
Exception in thread "main" java.lang.RuntimeException:
Aborting: can't find classfile java.lang.Object
         at soot.Scene.getSootClass(Scene.java:381)
         at soot.javaToJimple.ClassResolver.createClassDecl 
(ClassResolver.java:86)
         ... etc ...

--Michal




More information about the Soot-list mailing list