wood burning stoves 2.0*
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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 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

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: 24183

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: http://aspose.com/file-tools
subject: NoClassDef erorr
Similar Threads
Calling java from C
Exception in thread "main" java.lang.NoClassDefFoundErorr: com/sun/tools/javac/Main
Why does my java program only run with -debug in my parameters
possible classpath problem?
java on command