This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes NoClassDefFoundError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NoClassDefFoundError" Watch "NoClassDefFoundError" New topic
Author

NoClassDefFoundError

raja srinivas
Greenhorn

Joined: Jun 22, 2001
Posts: 20
Hi guys,
this is a pathetically obvious error which i am unable to resolve. The thing is i have a simple program that i am running from the command prompt through the command "java filename" and i keep getting the NoClassDefFoundError in thread main. The class file is in the same folder from which i am trying to run it , still i keep getting this runtime error. Can anyone help to get me out of this frustrating position.
Thanks
Raja
karl koch
Ranch Hand

Joined: May 25, 2001
Posts: 388
hi,
is your class in a package ?
if yes, then you have to run it with java packageName.Classname from the "root" of your class files.
check the classpath variable too.

k
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Raja,
You must have "." in your classpath to work with any java file in the current directory.
Regards,
Manfred.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Originally posted by raja srinivas:
this is a pathetically obvious error

that about a zillion of us have stumbled on at one time or other !
As stated above - either make sure that the directory that the class file is in is stated in the classpath, or have a dot reference in your classpath and start the app from the directory that it is in.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Art Teye
Greenhorn

Joined: Dec 20, 2001
Posts: 2
just askin -- did you save it as yourclass.java? Example: class HelloWorld saved as HelloWorld.java.
[This message has been edited by Art Teye (edited December 20, 2001).]
raja srinivas
Greenhorn

Joined: Jun 22, 2001
Posts: 20
Thanks guys,
thats what the problem was, i did have the folder in my classpath !! Jeez !!
THanks a ton
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NoClassDefFoundError