Exception in thread "main" java.lang.NoClassDefFoundError
转载自http://stackoverflow.com/questions/6334148/exception-in-thread-main-java-lang-noclassdeffounderror?answertab=votes#tab-top
One of the places java tries to find your .class
file is your current directory. So if your .class
file is in C:java
, you should change your current directory to that.
To change your directory, type the following command at the prompt and press Enter:
cd c:java
This .
tells java that your classpath is your local directory.
Executing your program using this command should correct the problem:
java -classpath .HelloWorld