[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 06:33:01 EDT 2012


Hi Quentin,

Thank you so much for your response. I am trying to create the call 
graphs for classes without a main method. From previous posts, I 
understand that it we need to define entry points. If you look at my 
Soot driver class (CallGraphExample) I have defined the entry points.

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);
  }
}



Do you have any idea on how I can construct a CFG for classes without 
main method?

Thank you so much for your help!

-Pauline



On 25/09/12 09:55, soot-list-request at sable.mcgill.ca wrote:
> Send Soot-list mailing list submissions to
> 	soot-list at sable.mcgill.ca
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
> or, via email, send a message with subject or body 'help' to
> 	soot-list-request at sable.mcgill.ca
>
> You can reach the person managing the list at
> 	soot-list-owner at sable.mcgill.ca
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Soot-list digest..."
>
>
> Today's Topics:
>
>     1. SootMethod ======  declaresMethod() ( ??? )
>     2. Re: SootMethod ======  declaresMethod() (Quentin Sabah)
>     3. Exception in thread "main" java.lang.RuntimeException: There
>        is no main class set! (Pauline Anthonysamy)
>     4. Re: Exception in thread "main" java.lang.RuntimeException:
>        There is no main class set! (Quentin Sabah)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 25 Sep 2012 15:50:49 +0800
> From: " ??? " <1241635403 at qq.com>
> Subject: [Soot-list] SootMethod ======  declaresMethod()
> To: " soot-list at sable.mcgill.ca "	<soot-list at sable.mcgill.ca>
> Message-ID: <tencent_44B79F12087EB26C31F8F081 at qq.com>
> Content-Type: text/plain; charset="gb18030"
>
> Hi :
>    I need your help!
>    I encounter  the same question you have 6 years ago!
>     Could you tell me how did you resolved at last?
>    Another question: Do you know whether Soot inplements the CTA ?
>    Thanks in advance!
>
>     Best wishes!
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20120925/6c31e370/attachment-0001.html
>
> ------------------------------
>
> Message: 2
> Date: Tue, 25 Sep 2012 10:09:12 +0200
> From: Quentin Sabah <quentin.sabah at inria.fr>
> Subject: Re: [Soot-list] SootMethod ======  declaresMethod()
> To: soot-list at sable.mcgill.ca
> Message-ID: <506166A8.901 at inria.fr>
> Content-Type: text/plain; charset=gb18030; format=flowed
>
> Hi,
>
>> I encounter the same question you have 6 years ago!
> Could you re-phrase that question? I doubt anyone can remember a 6 years
> old question.
>
>> Another question: Do you know whether Soot inplements the CTA ?
>> Thanks in advance!
> Please tell us what CTA stands for, so that we may help you.
>
> Remember, you won't get much help if we cannot understand your
> questions. Consider investing a few minutes to explain us what you are
> willing to achieve using Soot.
>
> Regards,
>
>





More information about the Soot-list mailing list