• Post Reply Bookmark Topic Watch Topic
  • New Topic

compiling a client server application  RSS feed

 
Masoud shirzay
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a client server application in sockets. the client side has 5 classes. and the server side consists of 4 classes. now i want to compile them through the dos shell using the javac command but it wont work there is no problem with the code as it runs through the jar file.
my friend told me to use command
javac -d classes\ source\updater\*.java
and then use this command
java updater.UpdaterServer
where updater is the directory where the classes and the UpdaterServer is the class name.
and the same 2 commands should be used for the client side as well.
why do i have to do it this way what is the reason for this complex procedure of compiling why cant i just do javac UpdaterServer.java
i want to know please.
thanks
 
Jonas Isberg
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly what is it that doesn't work? Could you post the command that fails and the output?
 
Joe Ess
Bartender
Posts: 9442
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would actually have to use the command:

in order for the runtime to find the package updater under the classes directory.
Once you start writing non-trivial programs you will find that having all your code in one directory can get unmanagable and you may run into naming conflicts. Java provides the concept of a "package" as a way to organize code and classes as well as provide a way to manage the namespace of an envronment. For example, you can seperate your client and server code (as is often the case) into updater.client and updater.server packages. This organization also makes it easy to create client and server targeted JAR files, important if people will be downloading your code as an applet or WebStart application. Read the Java Tutorial chapter on Creating and Using Packages for some more examples.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!