Program Execution Instructions

In the Instructions.html document, it states that in the ReadMe document we need to specify exactly how to start the program. "...do not say something like "add server.jar to your classpath". You should document exactly how to add the jar file to the classpath." Well depending on the OS, there are several different methods for setting and getting environment variables (such as classpath), do we need to document this operation for each concievable OS? This is problem #1. As an work around, I thought about just setting the classpath in the command line, which is feasible but brings up another problem. The JAR tool has issues tyring to set the classpath in the command line: Issue 1: Do we need to include instruction on how to unjar the jar file? If so, the JAR command does not allow you to specify the class path in the command line. The only other option is to set this environment variable, which leads to problem #1 (above), where we have to document how to set the classpath for every type of OS. Issue 2: In the case where we have a Server.jar, Client.jar and then a Total.jar (containing all submission files). If you try to set the classpath in the command line you run into problems using Total.jar in your classpath and then using the "-jar" flag to start Client.jar. So, the following code does not work.java -classpath c:\temp\Total.jar -jar Client.jar I realize that I am probably agonizing over this detail too much, but it would be horrible if a submission got rejected because the execution instructions weren't stupid-proof. Likewise, I realize that there is probably a simple, yet clever way to document setting the classpath for all OSs. Ideally, I would like the user to set the classpath as an environment variable and not rely on having to include it in all of my command lines. So if anyone has a sufficient method for documenting this task, I would greatly appreciate it. Thanks so much. Steve

I wouldn't recommend fiddling with classpaths anyway. I think you will agree that your application should be an executable jar that can be run using the java -jar command. It's much more convenient. If you want to put your shared classes in a separate jar (say common.jar), you can use the Class-Path manifest attribute to "glue" client.jar and server.jar to this common.jar. All the instructions will have to say is things like go to the directory where you unpacked the application and run "java -jar client.jar <remotehost ort>" (or whatever your command line is). - Peter [ January 02, 2003: Message edited by: Peter den Haan ]

So, the following code does not work. java -classpath c:\temp\Total.jar -jar Client.jar

The -classpath parameter is ignored when "java -jar ..." is run. Why do you need classpath anyway? Eugene.

steve nicholls
Greenhorn

Joined: Dec 10, 2002
Posts: 20

posted Jan 02, 2003 13:45:00

0

Let me clarify this issue a little more, I think I probably confused everyone with a deluge of hypotheticals. The instructions want us to specify how to add the JAR to the classpath. "...do not say something like 'add server.jar to your classpath' You should document exactly how to add the jar file to the classpath.". What is an acceptable way of documenting this? Peter you stated: "All the instructions will have to say is things like go to the directory where you unpacked the application and run "java -jar client.jar <remotehost ort>" (or whatever your command line is)." Can we assume that the user unpacked the JAR inside a directory found in the CLASSPATH? I really appreciate your help Peter and Eugene. Let me know what you think? Steve

Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252

posted Jan 02, 2003 15:00:00

0

Originally posted by steve nicholls: The instructions want us to specify how to add the JAR to the classpath. [...] What is an acceptable way of documenting this?

No they don't want you to specify that. They just give this as an example. The instructions want you to specify how to run the application and the server. And they want these instructions to be explicit, dictating exactly what command line they should type. If running your application involves adding the jar to the classpath (I don't hope so), then you'd have to give explicit instructions how to do that. If not, you don't. - Peter [ January 02, 2003: Message edited by: Peter den Haan ]