• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic