[Soot-list] soot
Peng Li
lipeng360 at gmail.com
Thu Sep 14 19:30:10 EDT 2006
Hi,
I am writing a program to translate a very simple class helloworld.class to
helloworld.jimple, the helloworld.class is under the C:\workspace\translator
directory, but the eclipse always gave me the mistake of "couldn't find
class: helloworld.class (is your soot-class-path set properly?)" whatever I
tried different input parameter for setSootClassPath(). Could anyone give me
some suggestion? appreciated your help. My code is as following,
import soot.*;
import soot.options.Options;
import java.io.*;
public class ClassToJimple {
public static void main(String[] args) throws IOException
{
Scene.v().setSootClassPath("C:/workspace/translator/");
SootClass c = Scene.v().loadClassAndSupport("helloworld.class");
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);
writerOut.flush();
streamOut.close();
}
}
Thanks
Lee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20060914/4dff0d10/attachment.htm
More information about the Soot-list
mailing list