[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scene



Hi, Pat,

I am tring to write to PrintClass.java of the example 1 in old soot
package. Unfortunately, it doesn't work out. Could you kindly check this
for me? 

The code is pretty simple, and liseted below. the runtime error is
java.lang.NoClassDefFoundError: java/util/ArrayList
        at soot.AbstractHost.<init>(Compiled Code)
        at soot.Scene.<init>(Compiled Code)
        at 
        at printClass.main(Compiled Code)

Do I need to set CLASSPATH for java.io.* and other stuffs of java? BTW,
I am using java 1.1.6, do you think there is any problem I use
1.1.6 instead of 1.2?

Thanks.

Liang
------

import soot.*;
import soot.jimple.*;
import java.io.*;

public class printClass
{
    public static void main(String[] args)
    {
        int printOptions = 0;  

        // Parse arguments
            if(args.length == 0)
            {
                System.out.println("Usage: java PrintClass <classname> [
-jimple | -jimp ]");
                System.exit(0);
            }
            else if(args.length == 2)
            {
                if(args[1].equals("-jimp"))
                    printOptions = PrintJimpleBodyOption.USE_ABBREVIATIONS;
            }       
        
        // Retrieve and print class.
        {
            //SootClassManager cm = new SootClassManager();
            SootClass sClass = Scene.v().getSootClass(args[0]);
            PrintWriter out = new PrintWriter(System.out, true);
            
            sClass.printTo(out, printOptions);
        }
    }
}