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

NoClassDefFoundError

 
Pruthvi raj
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15207
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic