Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't resolve java classpath issue #1101

Closed
abhijit819 opened this issue Jan 19, 2019 · 2 comments
Closed

can't resolve java classpath issue #1101

abhijit819 opened this issue Jan 19, 2019 · 2 comments

Comments

@abhijit819
Copy link

No description provided.

@abhijit819
Copy link
Author

abhijit819 commented Jan 19, 2019

Hi,

I am new to Soot and I tried the following code:

public class mytry
{
	public static void main(String[] args) {
		args = new String[] {"VeryBusyClass"};
		
		if (args.length == 0) {
			System.out.println("Usage: java RunVeryBusyAnalysis class_to_analyse");
			System.exit(0);
		}
	Options.v().set_soot_classpath("/home/abhijit/Desktop/soot/nightly_build/soot_10th_jan_2019/");	
   		Options.v().set_keep_line_number(true);
		SootClass sClass = Scene.v().loadClassAndSupport(args[0]);		
		sClass.setApplicationClass();
		
		Iterator methodIt = sClass.getMethods().iterator();
		while (methodIt.hasNext()) {
			SootMethod m = (SootMethod)methodIt.next();
			Body b = m.retrieveActiveBody();
			
			System.out.println("=======================================");			
			System.out.println(m.toString());
		}
	}
}

Running this command :
java -cp sootclasses-trunk-jar-with-dependencies.jar:.:/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar mytry

The error is:

Exception in thread "main" soot.SootResolver$SootClassNotFoundException: couldn't find class: 
java.lang.Object (is your soot-class-path set properly?) Try adding rt.jar to Soot's classpath, e.g.:
java -cp sootclasses.jar soot.Main -cp .:/path/to/jdk/jre/lib/rt.jar <other options>
	at soot.SootResolver.bringToHierarchyUnchecked(SootResolver.java:232)
	at soot.SootResolver.bringToHierarchy(SootResolver.java:214)
	at soot.SootResolver.bringToSignatures(SootResolver.java:279)
	at soot.SootResolver.processResolveWorklist(SootResolver.java:172)
	at soot.SootResolver.resolveClass(SootResolver.java:134)
	at soot.Scene.loadClass(Scene.java:942)
	at soot.Scene.loadClassAndSupport(Scene.java:927)
	at mytry.main(mytry.java:37)

Can you please help me out with understanding what's going wrong here. How can I load the rt.jar?

Thanks and regards,
Abhijit

@mbenz89
Copy link
Contributor

mbenz89 commented Jan 21, 2019

Soot complains that it cannot find any source for the java.lang.Object class. You can either add the rt.jar to Soot's class path explicitly (as stated in the error message): java -cp sootclasses-trunk-jar-with-dependencies.jar:.:/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar soot.Main -cp .:/path/to/jdk/jre/lib/rt.jar mytry. Or you use the -prepend-classpath option that will add your java class path to Soot's: java -cp sootclasses-trunk-jar-with-dependencies.jar:.:/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar soot.Main -pp mytry

@mbenz89 mbenz89 closed this as completed Jan 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants