java.lang.ClassNotFoundException in Netbeans. 5 hours to fix

Posted by user1304281 on Stack Overflow See other posts from Stack Overflow or by user1304281
Published on 2012-03-30T22:59:27Z Indexed on 2012/03/30 23:29 UTC
Read the original article Hit count: 214

Filed under:
|

Hi I've got to submit an interpreter assignment tonight and all of a sudden it stopped working! It was working yesterday but now when I try to create a class instance at runtime I get classnotfoundexception. My project has no libraries or dependencies, I've written everything myself. I've googled around and it seems to be an issue with classpath but I've had no luck fooling with the project properties on netbeans. Here's some code:

package interpreter;

import interpreter.bytecode.ByteCode;
import java.io.*;
import java.lang.reflect.*;

class ByteCodeLoader {

//....

  String codeClass = CodeTable.CodeTable.get(args[0]);
  ByteCode bytecode = (ByteCode)(Class.forName("interpreter.bytecode."+codeClass).newInstance());  //this throws exception
}

all of my ByteCodes are contained within a subpackage of interpreter called interpreter.bytecode. I'll be watching this thread so I can answer/clarify any questions immediately. Thanks for your time!

© Stack Overflow or respective owner

Related posts about java

Related posts about homework