Could anybody help me out with this problem? I have created the jar files server.jar and client.jar with their manifest file from the command prompt window. I do not have a problem with jarring them up. The trouble that I am having is that I can`t run them in the proper manner eg: java -jar server.jar I have to put in the full path to the jar file eg java -jar C:\jdk1.3\server.jar I have tried everything, adding the jars to my classpath and nothing works. I just keep getting the same error message java.util.ZipException system coiuld not find the specified file. I want to be able to run the jars from any directory without putting in the full paths. The answer to this quandary is probably very simple, something that I am overlooking. This is the only thing holding me up uploading the assignment and it is all starting to tick me off a tad. I never expected to get a problem from the simpler things. Any help most appreciated. Steve.
Thanks Mark for replying My command was the same as how you wrote it above except I left out the v for verbose eg jar cmf server.jar C:\jdk1.3\suncertify\man.mf suncertify\server\*.class I do not have a problem running it from the jar if I put in the full path to the jar. However, I would like to be able to run it from any directory with just the command java -jar server.jar
Hi Mark and Matthew Firstly inside my jar I have Main-class: suncertify.server.DataServer which point to the class to run. I have added the classpath just like Matthew said to no avail. I have tried all different ways of adding it to my calsspath. The strange thing is that I can run the program within the jar by calling java suncertify.server.DataServer from any directory, so the jar is in my classpath. Also I can run the jar by specifying the whole path to the jar eg: java -jar C:\jdk1.3\server.jar For some reason I cannot run it without specifying the path to the jar. Got me stumped. Steve.
If that works, and not java -jar server.jar then 1. Classpath is not set to where the jar file resides. or 2. You are not running the jar file from the directory the jar file is in. Meaning if you have the jar in c:\devexam run it from the c:\devexam directory. Mark
Yes Mark you are right. If I run it in the directory which contains the jar, there is no problem. I have tried setting the classpath to the directory that the jar resides in eg: set classpath=c:\jdk1.3 or many other variations of this command including set classpath=C:\jdk1.3\server.jar. My concern is that in the specs it states that you should be able to run the program in any directory, if any environmental setup is needed you should document how to add the jar to the classpath or something along those lines. So I an trying to get this sorted before I upload. I suppose I could tell them to add the jar to the classpath and run it like so: java suncertify.server.DataServer which works fine. But I was trying to sort out the former way as I think it is a better way to run the program.