Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Getting the BCEL to work

843829Oct 24 2005 — edited Oct 24 2005
I have been trying to run the following program
import java.io.IOException;

import org.apache.bcel.classfile.ClassParser;
import org.apache.bcel.classfile.ConstantPool;
import org.apache.bcel.classfile.JavaClass;

public class BCELTest {

	public static void main(String[] args) {
		try {
			ClassParser parser = new ClassParser("HelloWorld.class");
			JavaClass jClass = parser.parse();
			//jClass.dump(System.out);
			System.out.println(jClass.toString());
			
			ConstantPool cPool = jClass.getConstantPool();
			System.out.println("****Constant Pool****");
			System.out.println(cPool.toString());
			
		} catch(IOException ioEx) {
			ioEx.printStackTrace();
		}
		
	}
}
I am recieving a number of errors when attempting to compile this program. The packages are not recognised, I have set my CLASSPATH to bcel.jar but I am still recieving the errors, would anybody have any idea how I could solve this problem?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 21 2005
Added on Oct 24 2005
1 comment
194 views