aspose file tools*
The moose likes Beginning Java and the fly likes Need Help in Running this Observer Pattern code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need Help in Running this Observer Pattern code" Watch "Need Help in Running this Observer Pattern code" New topic
Author

Need Help in Running this Observer Pattern code

jittu goud
Ranch Hand

Joined: Mar 30, 2007
Posts: 46
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

Joined: Mar 20, 2001
Posts: 210

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

Joined: Oct 27, 2005
Posts: 19542
    
  16

See also this thread, which had exactly the same problem.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
jittu goud
Ranch Hand

Joined: Mar 30, 2007
Posts: 46
Thanks a Lot Friends That was so helpful :cheers:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need Help in Running this Observer Pattern code
 
Similar Threads
Transmogrify
Use of package statement
help !!
Packageing a Jar does not work
help with marcus questions