Saturday, December 17, 2011

Java Exception in thread "main" java.lang.NoClassDefFoundError

There are several Java Virtual machines and the most popular one is the Oracle Java SE. Sometime we use a remote or cloud server or run between cross platforms, even for a simple hello world Java program, we often get the "Exception in thread "main" java.lang.NoClassDefFoundError" that the class which you are trying to run was not found in the classpath, because the java.exe does not take current directory by default!  The "-cp option" may help:

java -cp "C:/Program Files/Java/jdkxxx/jre/lib;./;"

Please pay attention at the "./" at the end of the paths. See more detail in

No comments:


Blog Archive

About Me

My photo
HD Multimedia Technology player