I have this class stored in
C:/CODE/src/
I open up the CMD and type in
C:/CODE/src>java -cp . Hello
And then it gives me this error
Exception in thread "main" java.lang.NoClassDefFoundError: Hello <wrong name: src/hello>
The java version is “1.7._02”
I do not know what else to do?
It complies and runs in eclipse IDE but not from the Command Console?
What should I do to rectify this problem?
public class Hello {
public static void main(String[] args) {
System.out.println("Hello");
}
}
Environment Variables
JAVA_HOME = C:\Program Files\Java\jdk1.7.0_02\bin\;
PATH = C:\Program Files\Java\jdk1.7.0_02\bin\;
You should be running the command in the dir with the
Hello.classfileYou are running into in the
srcwhich has only yourHello.javafileYou will find the
Hello.classfile under/bin(that’s where Eclipse places them)