Problem on executing a Java program
When I executed my program exo3.class, there was an error message like this:
Exception in thread "main" java.lang.NoClassDefFoundError: exo3
even after compile exo3.java and create the exo3.class.
Could you help me please?
For more info: I use the JSDK 1.4.2_10 in Windows
[303 byte] By [
ColdWinda] at [2007-10-2 6:10:27]

Hello,the solution can be found there: http://forum.java.sun.com/thread.jspa?forumID=256&threadID=405248Try to search this forum for NoClassDefFoundError, a lot of threads about this topic has been already answered.L.P.
lukika at 2007-7-16 13:11:06 >

The problem might be that you have used the package in your source code using the key word
package somepackagename;
and you might be trying to run it with out specifying the package name...
when compiling with packages use javac -d . exo3.java
and this iwll produce the directory with your package name
and then execute it using
java packagename.exo3
All The Best
Hi,
I was struggling with these problem too. But I've found the solutions.
There are many ways:
1. You must set the classpath to the appopriate path
use :
set classpath=
then try to compile again
2. if number 1 doesnt work. You may manually set the classpath using:
javac -cp <classpath directories> YourJavaFile.java
view the help file abot the use of -cp.
Hope you find it usefull.