• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need Help in Running this Observer Pattern code

 
jittu goud
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all ,
iam trying to run a example code from orielly website .. i downloaded the examples from http://www.headfirstlabs.com/books/hfdp/HeadFirstDesignPatterns_code102507.zip
i unzipped and went to observer pattern directory...and then compiled the sources.... but iam struck in calling the test code to run the main method..

here is what i get

C:\Users\jithendar\Desktop\headfirst\HF_DP\src\headfirst\observer\weather>java WeatherStation
Exception in thread "main" java.lang.NoClassDefFoundError: WeatherStation (wrong
name: headfirst/observer/weather/WeatherStation)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
4)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
 
Wirianto Djunaidi
Ranch Hand
Posts: 210
Ruby Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jithendar,

You need to go up your directory to C:\Users\jithendar\Desktop\headfirst\HF_DP\src and run "java headfirst.observer.weather.WeatherStation" from there
 
Rob Spoor
Sheriff
Pie
Posts: 20372
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See also this thread, which had exactly the same problem.
 
jittu goud
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a Lot Friends That was so helpful :cheers:
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic