[Soot-list] soot
Peng Li
lipeng360 at gmail.com
Mon Sep 18 00:54:57 EDT 2006
Hi everyone,
I am using soot to write a very simple program to translate a .class file to
a .jimple file.But because this is my first soot program, I have been
stucked for almost 1 week. Could you give me some help?
The purpose: write a program to translate a .class file to a .jimple file
I am using eclipse plug-in. I just install the eclipse plugin as the
instruction on the soot website and don't do any setting on my eclipse. I
don't use any command line to run soot.
code:
import soot.*;
import soot.options.Options;
import java.io.*;
public class ClassToJimple {
public static void main(String[] args) throws IOException
{
soot.options.Options.v().set_app(true);
Scene.v
().setSootClassPath("C:/workspace/translator;C:/j2sdk1.4.2_12/jre/lib/rt.jar");
SootClass c = Scene.v().loadClassAndSupport("helloworld");
String fileName = SourceLocator.v().getFileNameFor(c,
Options.output_format_jimple);
OutputStream streamOut = new FileOutputStream(fileName);
PrintWriter writerOut = new PrintWriter(new
OutputStreamWriter(streamOut));
Printer.v().printTo(c, writerOut); //this line makes the error
writerOut.flush();
streamOut.close();
}
}
I got the following error,
Exception in thread "main" java.lang.RuntimeException: method <init> has no
active body!
at soot.Printer.printTo(Printer.java:206)
at ClassToJimple.main(ClassToJimple.java:20)
Thank you very much for your help and looking forward to hearing from you.
Cheers
P
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20060918/25f07e8e/attachment.htm
More information about the Soot-list
mailing list