• 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

Chapter 15 Head First - DailyAdviceClient and DailyAdviceService

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!! I just wrote both code of DailyAdvice program and compiled both without errors. But when I try to execute the server I got this:


Exception in thread "main" java.lang.NoClassDefFoundError: DailyAdviceServer/jav
a
Caused by: java.lang.ClassNotFoundException: DailyAdviceServer.java
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: DailyAdviceServer.java. Program will exit.



The same thing happen when I execute my DailyAdviceClient.class

The program works fine on netbeans though...but on prompt ....

The two codes are like this:



And:



What am i doing wrong???
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Exception in thread "main" java.lang.NoClassDefFoundError: DailyAdviceServer/java
Caused by: java.lang.ClassNotFoundException: DailyAdviceServer.java
at java.net.URLClassLoader$1.run(Unknown Source)




It looks like you ran ....

java DailyAdviceServer.java

Instead of....

java DailyAdviceServer



Henry
 
Douglas Carvalho
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, that´s right!!! It just past midnight..... so I was using the arrows of keyboard so the command should turn this:

javac DailyAdviceServer.java

to this

java DailyAdviceServer

but I forgor to delete the .java ..... Thank you very much!! It worked fine now....

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic