[Soot-list] Exception in thread "main" java.lang.RuntimeException: There is no main class set!

Pauline Anthonysamy anthonys at comp.lancs.ac.uk
Tue Sep 25 04:37:11 EDT 2012


Hello Eric,

I am reposting this message as I am still failing to figure out why am I
getting this exception ("Exception in thread "main"
java.lang.RuntimeException: There is no main class set!") even when I have
set the main class to be "*test.CallGraphs*".

I am using eclipse (not sure if this matters, probably not). My build path
has*sootclasses.jar*, * jce.jar* and *jre system library*.

I have searched through the mail archives for a working example but haven't
had any luck :-(
Can someone please have a look at my code below and advise if I am making a
mistake any where??


package test;

public class CallGraphExample {
 public static void main(String[] args) {
  // create a list from args
 List<String> argsList = new ArrayList<String>(Arrays.asList(args));
  // add on the following arguments
 argsList.addAll(Arrays.asList(new String[]{"-w", "test.CallGraphs"}));

  // PackManager manages the packs containing the various phases and their
options
 PackManager.v().getPack("wjtp")
 .add(new Transform("wjtp.myTransform", new SceneTransformer() {

@Override
 protected void internalTransform(String phaseName, Map options) {
 CHATransformer.v().transform();
 SootMethod src = Scene.v().getMainClass().getMethodByName("doStuff");
  ArrayList<SootMethod> entryPoints = new ArrayList<SootMethod>();

 entryPoints.add(src);
 Scene.v().setEntryPoints(entryPoints);
 CallGraph cg = Scene.v().getCallGraph();
 Iterator<MethodOrMethodContext> targets = new Targets(cg.edgesOutOf(src));

 while (targets.hasNext()) {
 SootMethod tgt = (SootMethod)targets.next();
 System.out.println(src + " may call " + tgt);
 }
 }
 }));
  args = argsList.toArray(new String[0]);
 soot.Main.main(args);
 }
}


package test;

public class CallGraphs {
public static void doStuff() {
StringBuilder b = new StringBuilder("Blah");
 b.append(" Blah");
new A().foo();
 }

}

package test;

public class A {
public void foo() {
bar();
 }
 public void bar() {
 }

}


Any pointers will be highly appreciated!!

Many Thanks,
-Pauline



-- 
Pauline Anthonysamy
School of Computing and Communications,
InfoLab 21, South Drive,
Lancaster University,
Lancaster LA1 4WA.
<j.noppen at comp.lancs.ac.uk>
Tel: +44-1524-510346
Fax: +44-1524-510492
Mail: anthonys at comp.lancs.ac.uk
Web: http://www.comp.lancs.ac.uk/~anthonys/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20120925/540bb90d/attachment.html 


More information about the Soot-list mailing list