• 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

NoClassDefFoundError

 
Ranch Hand
Posts: 115
Firefox Browser Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have recently formatted my system and i have again set the required path and classpath

(ie : controlpanel->system->adv->env variable->new->set path where jdk 1.5 bin is located)

All other programs run and compile fine except for the programs that contain packages.

the programs that contain packages compile and the class file is created but when i try to run the program
(eg:java world.HelloWorld where world is the name of the package and HelloWorld is the name of the source file) i get an error that says

Exception in thread "main" java.lang.NoClassDefFoundError: world/HelloWorld

on the command prompt.
I have tried everything possible(even compiling with java -classpath . food.Junk gives the same error)

I SURRENDER

PLEASE HELP ME

P.S: package files would compile and run before formatting my pc.....i dont know whats the problem now.

 
Saloon Keeper
Posts: 15485
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What value are you using for CLASSPATH, and what is the absolute path to your class file?
 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In command prompt be one level top of directory world. Now try the following
java -cp . word.HelloWorld

If you execute from any different location parameter to -cp will differ.
 
sumedha rao
Ranch Hand
Posts: 115
Firefox Browser Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
problem solved.......thanks swastik

damn it was so easy and i was slogging with it since an hour
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic