soot-oss / soot

Soot - A Java optimization framework
GNU Lesser General Public License v2.1
2.89k stars 708 forks source link

Some examples cannot run. #195

Closed Elderry closed 10 years ago

Elderry commented 10 years ago

I imported whole Soot project into my eclipse, then added tutorial/guide/examples/analysis_framework/src into Build Path. However, GenHelloWorld.java cannot run, error message:

Generating class...
Writing class file...
Exception in thread "main" java.lang.IllegalStateException: RefType java.lang.ArithmeticException not loaded. If you tried to get the RefType of a library class, did you call loadNecessaryClasses()? Otherwise please check Soot's classpath.
    at soot.Scene.getRefType(Scene.java:686)
    at soot.toolkits.exceptions.ThrowableSet$Manager.<init>(ThrowableSet.java:194)
    at soot.Singletons.soot_toolkits_exceptions_ThrowableSet_Manager(Singletons.java:766)
    at soot.toolkits.exceptions.ThrowableSet$Manager.v(ThrowableSet.java:275)
    at soot.toolkits.exceptions.UnitThrowAnalysis.<init>(UnitThrowAnalysis.java:198)
    at soot.Singletons.soot_toolkits_exceptions_UnitThrowAnalysis(Singletons.java:772)
    at soot.toolkits.exceptions.UnitThrowAnalysis.v(UnitThrowAnalysis.java:225)
    at soot.Scene.getDefaultThrowAnalysis(Scene.java:1041)
    at soot.toolkits.graph.ExceptionalUnitGraph.<init>(ExceptionalUnitGraph.java:197)
    at soot.toolkits.scalar.FastColorer.assignColorsToLocals(FastColorer.java:184)
    at soot.jimple.JasminClass.assignColorsToLocals(JasminClass.java:71)
    at soot.jimple.JasminClass.emitMethodBody(JasminClass.java:165)
    at soot.AbstractJasminClass.emitMethod(AbstractJasminClass.java:749)
    at soot.AbstractJasminClass.<init>(AbstractJasminClass.java:628)
    at soot.jimple.JasminClass.<init>(JasminClass.java:63)
    at dk.brics.soot.GenHelloWorld.write(GenHelloWorld.java:106)
    at dk.brics.soot.GenHelloWorld.main(GenHelloWorld.java:19)

RunLiveAnalysis.java also can't run, after adding this line:

Options.v().set_soot_classpath(".\\tutorial\\guide\\examples\\analysis_framework\\src;C:\\Program Files\\Java\\jre7\\lib\\rt.jar;");

Now the error message:

<testers.VeryBusyClass: void main(java.lang.String[])>
Exception in thread "main" java.lang.IllegalStateException: RefType java.lang.RuntimeException not loaded. If you tried to get the RefType of a library class, did you call loadNecessaryClasses()? Otherwise please check Soot's classpath.
    at soot.Scene.getRefType(Scene.java:686)
    at soot.toolkits.exceptions.ThrowableSet$Manager.<init>(ThrowableSet.java:192)
    at soot.Singletons.soot_toolkits_exceptions_ThrowableSet_Manager(Singletons.java:766)
    at soot.toolkits.exceptions.ThrowableSet$Manager.v(ThrowableSet.java:275)
    at soot.toolkits.exceptions.UnitThrowAnalysis.<init>(UnitThrowAnalysis.java:198)
    at soot.Singletons.soot_toolkits_exceptions_UnitThrowAnalysis(Singletons.java:772)
    at soot.toolkits.exceptions.UnitThrowAnalysis.v(UnitThrowAnalysis.java:225)
    at soot.Scene.getDefaultThrowAnalysis(Scene.java:1041)
    at soot.toolkits.graph.ExceptionalUnitGraph.<init>(ExceptionalUnitGraph.java:197)
    at dk.brics.soot.RunVeryBusyAnalysis.main(RunVeryBusyAnalysis.java:44)
yehjames commented 10 years ago

I have same problem.Did you find any solution on this problem?

Elderry commented 10 years ago

I have solved this problem in this commit(https://github.com/Sable/soot/pull/196), thus if you are using the latest version, I'm afraid you are meeting a different problem from mine.