Forums Register Login

compiling a client server application

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
Exactly what is it that doesn't work? Could you post the command that fails and the output?
+Pie Number of slices to send: Send
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.
Paper beats rock. Scissors beats tiny ad.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 750 times.
Similar Threads
Printing through a web application
Launching java application from batch file
Tomcat not loading its jars to classpath at run time
launching application with java command line
From "Head First EJB" - pg. 57
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 08:33:22.