Java: Exception in thread main java.lang.NoClassDefFoundError

Following is one of the exceptions which beginner could face :

Exception in thread “main” java.lang.NoClassDefFoundError

This mainly occurs when it doest find the classpath reference or class path ifslef not set.

Executing the program using this command can correct the problem:
java -classpath . yourjavacode

where yourjavacode is the name of your compiled class.

You may also want to read this :

CLASSPATH in Java which will help you to understand the Java CLASSPATH.

This tells java that your classpath is your local directory.
Share on Google Plus

About Pranav

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment


Post a Comment