This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 19655
    
  18

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
help !!
help with marcus questions
Packageing a Jar does not work
Use of package statement
Transmogrify