This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara 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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "NoClassDefFoundError" Watch "NoClassDefFoundError" New topic
Author

NoClassDefFoundError

Pruthvi raj
Greenhorn

Joined: Dec 30, 2008
Posts: 1
i have java file One.java in Test directory and i am comipiling this file as java Test.One as my present working directory as c:\Test but its throwing error.Can anybody please suggest.
And even tried java -classpath . Test.One, then also same problem.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14116
    
  16

Welcome to JavaRanch. NoClassDefFoundError (almost) always means that your classpath is not set correctly.

i have java file One.java in Test directory and i am comipiling this file as java Test.One

You mean, that's how you run (not compile) the class. Has One.java a package statement at the top of the source file, like this:

If that's the case, then you need to add the parent directory of the directory named Test to the classpath. Since directory Test is in the root directory, try this:

(note the space between C:\ and Test.One).


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
 
subject: NoClassDefFoundError