File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt: Qn 12 from K&B SCJP 6.0 chapter Development Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt: Qn 12 from K&B SCJP 6.0 chapter Development" Watch "Doubt: Qn 12 from K&B SCJP 6.0 chapter Development" New topic
Author

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

Gouri Kumari
Greenhorn

Joined: Jul 06, 2010
Posts: 22
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

Joined: Jul 06, 2010
Posts: 22
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
 
subject: Doubt: Qn 12 from K&B SCJP 6.0 chapter Development