• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to run a socket?  RSS feed

 
W Lam
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am testing a Server and Client socket and see if it works but some how it doesn't run.
After I compiled the java file, I run the my class file and I got an error message:
Exception in thread "main" java.lang.NoClassDefFoundError: Server
What does this mean?
 
Ryan Langley
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
It appears that the java interpreter cannot find where the class called "Server" is compiled. Make sure that there is a file called Server.class in the directory that you are attempting to run it in. Case does matter! (i.e. server != Server) It is either that, or the path where the class file is located cannot be found by the interpreter from the class path. For instance, if C:\code is where your Server.class file is located, make sure that you included that directory in the classpath. If the Server.class file is in another directory under a directory that is in the classpath you could also set the package to the nested directory structure in the Server.java file. For instance if C:\code is in the classpath, and the Server.class file is located under C:\code\my\server you could put
package my.server;
on the first non-comment line of the Server.java file. Then from C:\code you could run it by using the command:
java my.server.Server
Hope this helps you out! Good luck.
Cheers,
RL
[This message has been edited by Ryan Langley (edited May 23, 2001).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!