Getting Started

First create a custom main class in one of your Java projects. An example would be the following class, that injects a new BodyTransformer to run an instance of MyAnalysis and print the name of the method associated with each body that is visited:

public class MyMain {

public static void main(String[] args) {
PackManager.v().getPack("jtp").add(new Transform("jtp.myTransform",new BodyTransformer(){

protected void internalTransform(Body body, String arg1, Map arg2) {
new MyAnalysis(new ExceptionalUnitGraph(body));
//use G.v().out instead of System.out so that Soot can
//redirect this output to the Eclipse console
G.v().out.println(body.getMethod());
}
});
soot.Main.main(args);
}

}

Set the Soot main class within Eclipse

When running Soot, you have to it to use your custom main class. To do so, right-click on the file you wish to analyze and then select Run Soot... or Manage Configurations... as usual. On the last tab, change the main class to the name of your custom main class, in the above example MyMain. Also you have to set the main project: If MyMain resides in project MySootExtension, then enter MySootExtension as main project.