This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The infamous "NoClassDefFoundError"

 
Jason Greenwood
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK. Yesterday, I read through all the threads on this topic, and got my work comp compiling and running without a problem. This morning I'm trying it at home, and I'm still getting the error

"Exception in thread "main" java.lang.NoClassDefFoundError: Test

I've got my CLASSPATH set to the following

.;C:\Program Files\Java\j2re1.4.2_05\lib\ext\QTJava.zip; C:\java stuff; C:\Program Files\Java\jdk1.5.0_06\bin

I can compile with javac just fine, but running the Test.class with the java command doesn't work.

What silly, simple thing am I missing? I'm not typing java Test.class, I've got my capitalization correct, I've tried it in both C:\java stuff (where I have the Test.class file) and in just straight C:\.

If you're not too tired of these, help would be appreciated.

Thanks!
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is your class with in some package?
 
Shaan Shar
Ranch Hand
Posts: 1249
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't write

Don't do: java Test.class

Do: just type java Test


Because Java run the class files without the ".class"
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ankur Sharma:
Don't do: java Test.class


Hmmm....that's what he said, isn't it?

Originally posted by Jason Greenwood:

I'm not typing java Test.class
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15272
37
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
...ext\QTJava.zip; C:\java stuff; C:\Program ...

Remove the spaces between the ; and C:\... in your classpath.
 
Jason Greenwood
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mani Ram:
Is your class with in some package?


Nope, all alone in it's own folder, straight off C.


Originally posted by Jesper Young:
...ext\QTJava.zip; C:\java stuff; C:\Program ...

Remove the spaces between the ; and C:\... in your classpath.


Ooohh... interesting... wouldn't have thought of that! Now I need to run home and change my CLASSPATH!

Thanks for the replies, all! I'll let you know if that works, Jesper!

 
Tony Morris
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jesper Young:
...ext\QTJava.zip; C:\java stuff; C:\Program ...

Remove the spaces between the ; and C:\... in your classpath.


Remove your CLASSPATH setting altogether and start again.
This QuickTime software seems to be causing a myriad of problems when it sets the CLASSPATH during install.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic