Page 1 of 2

java lang exception error

Posted: Wed Jan 28, 2004 6:26 pm
by sake
java.lang.NoClassDefFoundError: D:\Program Files\java\Java\Assignment 1\Stack/java
Exception in thread "main"
Tool completed with exit code 1

my program compiles on ctrl+1, but it won't execute, and i'm given the error above....

please help out ;)

Posted: Wed Jan 28, 2004 6:31 pm
by s_reynisson
Using Search I found, amongst other links, this. HTH

Posted: Wed Jan 28, 2004 6:36 pm
by sake
ok but what do i need to put in the class path, as the variable name, and the value?

Posted: Wed Jan 28, 2004 6:47 pm
by s_reynisson
Add the "." as a seperate entry in your classpath, like:
"c:\someotherpath\andmorepath\;."

Where do I go to modify my classpath?

What's your operating system?
For WinXP you can right click on My Computer, select "Properties",
select the "Advanced" tab, click "Environment Variables", under "System
variables" look for "classpath", create one if it does not exist, if that's
the case all it contains is the ".".

Posted: Wed Jan 28, 2004 9:19 pm
by sake
still getting the same error!

as the variable name i have > classpath
and the variable value i have > D:\Program Files\java\bin\;.

is that how it should look like?

Posted: Wed Jan 28, 2004 11:15 pm
by s_reynisson
Looks right to me sake, you could try putting the "." at the start of
your classpath since some users have problems with a space in
their classpath (or look for a Java install in for example "C:\j2sdk1.4.2_03\bin"
and change your classpath accordingly)
If this does not resolve your problem take a look at the Java FAQ

Ok, I just installed J2EE 1.4 SDK

Posted: Sat Jan 31, 2004 5:44 pm
by sake
I installed in a new directory. D:\Java\

I have my system variable classpath set to > classpath
and the variable value > D:\Java\jdk\bin\;.

I'm still getting the error below.

This is copy paste from Textpad.

java.lang.NoClassDefFoundError: D:\Java\Stack/java
Exception in thread "main"
Tool completed with exit code 1

Posted: Sat Jan 31, 2004 6:34 pm
by s_reynisson
Did you delete your Java tools under Configure->Preferences->Tools and
then add them again under Add->Java SDK Commands? HTH

Same java.lang.NoClassDefFoundError error, but have Win98 SE

Posted: Fri Feb 06, 2004 3:41 pm
by phrankndonna
Hello,

I've got the exact same problem that is outlined here. I can code and compile, but running the Java application leads to the 'Exception in thread "Main" java.lang.NoClassDefFoundError' message. However, I have Windows 98SE, and I'm not sure where to find the 'classpath' that's been mentioned for the WinXP fix. I tried modifying the Path in the Autoexec.bat file, but that didn't help. Any ideas? Thanks.

Frank

Posted: Fri Feb 06, 2004 4:35 pm
by s_reynisson
Try adding the "." to your classpath in autoexec.bat:
SET CLASSPATH=C:\JDK...\some other path;.
create it if you have to, then it might look like this:
SET CLASSPATH=.
But then again I last used win98 back in 98... ;)
HTH

different error now

Posted: Sat Feb 07, 2004 5:43 pm
by sake
I reinstalled Java again this version > Java 2 SDK SE 1.4.2

I reinstalled textpad again ( the newer version ) and I edited the classpath.

This is the error message that I'm getting right now when i hit CTRL+1.
http://www.sakexxx.com/screen.JPG

This is what i set Compile Java to
http://www.sakexxx.com/1.JPG
This is what i set on Run Java Application
http://www.sakexxx.com/2.JPG
This is what i set on Run Java Applet
http://www.sakexxx.com/3.JPG

This is what my classpath variables look like.
http://www.sakexxx.com/classpath.JPG

^^ in the class path you can see the directory that Java was installed into.
Thanks for all your help.

Posted: Sat Feb 07, 2004 5:48 pm
by s_reynisson
sake, you're missing a semicolon in your classpath, it should read
D:\Java\jdk\bin\;.
or just
D:\Java\jdk\bin;.
HTH

Edit: I double checked my TP tools settings for Java and they all look like yours.

Posted: Sat Feb 07, 2004 7:01 pm
by sake
I changed that and I still got the same error message. :(

Posted: Sat Feb 07, 2004 9:09 pm
by s_reynisson
Hmm, did you try adding D:\Java\jdk\bin to your path variable?
According to the error message your javac.exe is running from the
system32 folder under windows. I don't think you need D:\Java\jdk\bin
in your classpath. The classpath is used to locate .jar, .zip or .class files,
not the executables such as java.exe and javac.exe. HTH

Posted: Sat Feb 07, 2004 9:23 pm
by sake
so what should I put in my classpath then?
leave it empty?