Hi, I am really fuzzled on how to run a java program, which is contained in a jar file. I created server.jar based on all classes in my D:\suncertify\server\ directory. Originally I can run the server like the following: java -classpath D:\ suncertify.server.DataServer 8189 Now since I have the jar file, I think I do not need these .class files anymore, so I deleted D:\suncertify\server directory, now how can I run the server using my server.jar? Thanks, Zhu
Let me explain my question in detail: I have db.jar and server.jar, and other jar files, in D:\ I created the server.jar with a manifest file, containing Main-Class: suncertify.server.DataServer Now when I run java -classpath D:\ -jar server.jar 8189 it finds the main() in DataServer well, but this main() calls Data.class (which is in db.jar), which caused the error: the jvm can not find Data.class
DaDa, Do you have db.jar on the classpath? Try <code>%java -classpath D:\;db.jar -jar server.jar 8189</code> Jerry
Joined: Jan 07, 2001
Thanks Jerry, your suggestion works. Now I have two options: (1) create one jar file for each package I have, say db.jar containing suncertify.db; dbclient.jar containing suncerify.dbclient; dbserver.jar containing suncertify.dbserver; client.jar containing suncertify.client (2) create two jar files: client.jar containing suncertify.client, suncerify.dbclient, suncertify.db server.client containing suncertify.dbserver, suncertify.db The advantage of the first option is no redundancy of packages in different jars, while the advantage of the second option is it is a little easier to use. Which way do you use?