Forums Register Login

Chapter 15 Head First - DailyAdviceClient and DailyAdviceService

+Pie Number of slices to send: Send
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???
+Pie Number of slices to send: Send
 

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
+Pie Number of slices to send: Send
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....

This looks like a job for .... legal tender! It says so right in this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1948 times.
Similar Threads
UnknownHostException when trying to connect to localhost
Socket Problems :(
client-server error
Client/Server Communication Problem
HFJ Example problem, please help
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 05:59:43.