• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt: Qn 12 from K&B SCJP 6.0 chapter Development

 
Gouri Kumari
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can some one kindly help me with this problem ?
------------
Directory Structure:


Contents of GoDeep.java and Foo.java





MyJar.jar contains
myApp/Foo.class

I compiled GoDeep.java successfully using the javac command from current folder "x": javac -cp test\MyJar.jar GoDeep.java.
However when I try to execute the class file using java -classpath .:test/MyJar.jar GoDeep from current folder"x", a NoClassDefFoundError exception is generated. Why is this happening?





 
Gouri Kumari
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It was a mistake from my part. I was executing my java programs in Linux but recently I started executing it in Windows 7 and I forgot about changing the separator character for directories from : to ;. The execution of class file works fine after changing the java command to

java -cp .;test\MyJar.jar GoDeep.

Best,
Gouri
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic