java lang exception error

Using the Java SDK with TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

sake
Posts: 7
Joined: Wed Jan 28, 2004 6:23 pm
Contact:

java lang exception error

Post 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 ;)
sake
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

Using Search I found, amongst other links, this. HTH
Then I open up and see
the person fumbling here is me
a different way to be
sake
Posts: 7
Joined: Wed Jan 28, 2004 6:23 pm
Contact:

Post by sake »

ok but what do i need to put in the class path, as the variable name, and the value?
sake
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post 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 ".".
Then I open up and see
the person fumbling here is me
a different way to be
sake
Posts: 7
Joined: Wed Jan 28, 2004 6:23 pm
Contact:

Post 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?
sake
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post 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
Then I open up and see
the person fumbling here is me
a different way to be
sake
Posts: 7
Joined: Wed Jan 28, 2004 6:23 pm
Contact:

Ok, I just installed J2EE 1.4 SDK

Post 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
sake
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

Did you delete your Java tools under Configure->Preferences->Tools and
then add them again under Add->Java SDK Commands? HTH
Then I open up and see
the person fumbling here is me
a different way to be
phrankndonna
Posts: 1
Joined: Fri Feb 06, 2004 3:29 pm

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

Post 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
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post 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
Then I open up and see
the person fumbling here is me
a different way to be
sake
Posts: 7
Joined: Wed Jan 28, 2004 6:23 pm
Contact:

different error now

Post 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.
sake
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post 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.
Then I open up and see
the person fumbling here is me
a different way to be
sake
Posts: 7
Joined: Wed Jan 28, 2004 6:23 pm
Contact:

Post by sake »

I changed that and I still got the same error message. :(
sake
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post 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
Then I open up and see
the person fumbling here is me
a different way to be
sake
Posts: 7
Joined: Wed Jan 28, 2004 6:23 pm
Contact:

Post by sake »

so what should I put in my classpath then?
leave it empty?
sake
Post Reply