Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoClassDef erorr

 
Joe Cooper
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you can tell from the error above I am complete newbie. I am running java on windows NT (from a cygwin shell)

I can compile my helloWorld.java with no problems, but when running
java helloWorld I get the error java.lang.NoClassDefFoundError.

Doing some research I found that I can run
java -classpath . helloWorld

So my problem seems to be a classpath, however when I check my enviroment I find:
CLASSPATH=C:\Program Files\Java\jdk1.5.0_05\bin;C:\Program Files\Java\jre1.5.0_0

This is the correct path. Any help would be appreciated.

Thanks in advance.
 
kwame Iwegbue
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is your helloWorld class in a directory thats in your classpath?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not a correct setting for CLASSPATH. CLASSPATH is used to find .class files, not executable files, and in general, until you really know what you're doing, it's best to leave it completely unset -- i.e., you should have no CLASSPATH setting at all. See here for lots more info.
 
Joe Cooper
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help. Working now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic