aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Classpath Settings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Classpath Settings" Watch "Classpath Settings" New topic
Author

Classpath Settings

Vikas Sood
Ranch Hand

Joined: Sep 03, 2002
Posts: 109
Hi Friends,
Do we need to put in instructions of how to set up the classpath in the readme.txt,so as before the examiner tries to run the client or server code he/she set up the classpath as per instructions.
This might look like a silly question, but i have read somewhere,that an executable jar file,doesnt need to have classpath set.
Kindly comment.
vikas sood
Prakash Krishnamurthy
Ranch Hand

Joined: Oct 08, 2002
Posts: 154
Vikas,
I would think it is required. The instructions are pretty clear on this.
If any environmental setup is required, do not just say what needs to be done; provide instructions on how to perform the setup. For example, do not say something like "add server.jar to your classpath". You should document exactly how to add the jar file to the classpath

I think they are really clear about this.
frank sun
Ranch Hand

Joined: Apr 11, 2003
Posts: 102
But, I don't think we need to setup the classpath, because we just need the Java API and our own class.
and even we don't need to setup the Java_home.
All we need to set is to add the java.exe into the execute path.
Frank.
Vikas Sood
Ranch Hand

Joined: Sep 03, 2002
Posts: 109
Hi Prakash,
Does that mean that i will be setting classpath as to where to put my jar file on the examiner system,so as to run.Or you mean't that we need to have instructions for setting up classpath for java.exe.

VikasSood
Prakash Krishnamurthy
Ranch Hand

Joined: Oct 08, 2002
Posts: 154
Vikas,
Just before the client and / or the server is being started i need to add all the classfiles to the classpath.
So i say this in the readme.txt
on a command prompt please do the following
C:> set CLASSPATH=%CLASSPATH%,C:\fbnassignment;
I do not need the java home variable set in my assignment. WHen they are trying to unjar my files I tell the following
Let us assume that jDK is installed under C:\
then please do the following
C:\jdk1.3.1\bin\jar xvf c:\fbn\server.jar
I dont think doing this should be a problem.
Prakash Krishnamurthy
Ranch Hand

Joined: Oct 08, 2002
Posts: 154
Frank,
I am not very clear on what you have said. At least in my assignment there is a need to add server.jar to the server machines's classpath and the client.jar to the client machine's classpath.
How else will the server and client know where to find the classes? Did I not understand what you were trying to say?
pk
frank sun
Ranch Hand

Joined: Apr 11, 2003
Posts: 102
I'm working on the new assignment.
the instruction does not ask for that.
Actually, we run this application, and our needed classes are in the current working directory, so we don't need to add them into the classpath,
During my test, I removed the java_home, classpath, and just put the java.exe into the PATH, everything goes well.
In the new assgnment, the instructs requires the application can only bs started using this approach:
java -jar runme.jar [mode]
no matter what mode this application running.
Frank
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11523
    
100

Hi Prakash,
You said: in my assignment there is a need to add server.jar to the server machines's classpath and the client.jar to the client machine's classpath
This is not a requirement in the instructions is it? It is just a requirement because of your next statement:
How else will the server and client know where to find the classes?
If you are just using a "vanilla" jar file, then you probably need to set the class path.
But it becomes so much easier if you use an executable jar file. All I need to do to run my client application is type: java -jar client.jar
No classpath, no codebase, no security file.
Same for my server application: just java -jar server.jar
Of course, you can optionally add parameters to make either one behave differently. The client app also has an options screen so that the user can select modes etc., but it just works out of the box.
I do have a comment in my README.txt telling the user to change to the directory where they extracted the contents of my submitted jar file. But that is all I said. Technically that is not needed either, but it reduces the chances of someone breaking something.
Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
frank sun
Ranch Hand

Joined: Apr 11, 2003
Posts: 102
Agree!
classpath and java_home are not necessary.
Frank
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Classpath Settings