Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with program executing (NoClassDefFoundError)

Status
Not open for further replies.

Tuketko

Programmer
Nov 11, 2003
4
SK
I have this problem.
I wrote a simple code in NetBeans and when I try run it, it works. But when I write this same code (or another in where I use constructor for main class)in notepad and try it run via command line ("java.exe ...") I got this message:

'Exception in thread "main" java.lang.NoClassDefFoundError:evidencia (wrong name: evidencia)'

(where evidencia is name of class that contain main method)
 
do like this

java -classpath . evidencia
or
java -classpath fulldirectorypath evidencia

Ion Filipski
1c.bmp
 
Thanx by it doesn't work still.
When I run it without -classpath (or with -classpath pathtosourcedirectory evidencia )then output is like this:

Exception in thread "main" java.lang.NoClassDefFoundError: evidencia (wrong name
: Evidencia)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:250)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)

when I use
java -classpath c:progra~1\2sdk14~1\jre\lib evidencia
outpu is like this
Exception in thread "main" java.lang.NoClassDefFoundError: evidencia
 
is your evidencia in c:progra~1\2sdk14~1\jre\lib? If not, put there the right directory path to evidencia

Ion Filipski
1c.bmp
 
Take a look at thread269-613070 ...
 
Ok.
SO File Evidencia.java and Evidencia.class (+ other class files produced by javac) are in directory c:\krutek\java\source

if I type java -classpath c:\krutek\java\source evidencia
from directory c:\krutek\java\source
or
c:\program~1\2sdk14~1\bin\java -classpath c:\krutek\java\source evidencia

it still throw Exception in thread "main" java.lang.NoClassDefFoundError: evidencia
 
This is beacause your class name is "Evidencia" but you are trying to run "evidencia" - Java is case sensitive.

Do this on the command line :

set CLASSPATH=%CLASSPATH%;c:\krutek\java\source

java Evidencia
 
Ooooooo.
Thanx very, very, much (I knew that java is case sensitiv, but I don't know that so much:)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top