Hi Max and others
I am facing a very unusual problem. I have created an executable server jar file. I placed this file in the folder c:\amit.
I am able to run it using the
java -jar server.jar from the same directory where server.jar file is lying i.e. c:\amit.
However when i go to any other directory from prompt say
cd c:\xyz (REmember server.jar is still in c:\amit)
and execute java -jar server.jar it says :
Exception in
thread "main" java.util.zip.ZipException: The system cannot find the file specified
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:110)
at java.util.jar.JarFile.<init>(JarFile.java:115)
at java.util.jar.JarFile.<init>(JarFile.java:57)
I have set the classpath as well in the prompt
using the command
set CLASSPATH=%CLASSPATH%;c:\server\server.jar;
But still not working
Important thing is that i can also start the server as
java -jar <install-dir>/server.jar no matter what is my current working directory on the command prompt
1) How to solve the above problem
2) if i run the server usung java -jar <install-dir>/server.jar and don ask the client to set any classpath, will i fulfill the exam requirement
becoz the requirement says:
*******************************************
How to execute the programs. You must provide exact command-line instructions. 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. Note: your program must run correctly no matter what directory it is installed in.
********************************************
Amit