Meaningless Drivel is fun!
The moose likes Beginning Java and the fly likes NoClassDef erorr Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NoClassDef erorr" Watch "NoClassDef erorr" New topic

NoClassDef erorr

Joe Cooper

Joined: Nov 09, 2005
Posts: 2
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 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

Joined: Sep 02, 2000
Posts: 197
is your helloWorld class in a directory thats in your classpath?

Who dares, wins! (SAS motto)
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

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.

[Jess in Action][AskingGoodQuestions]
Joe Cooper

Joined: Nov 09, 2005
Posts: 2
Thanks for the help. Working now.
I agree. Here's the link:
subject: NoClassDef erorr
It's not a secret anymore!