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.
Show us your jar command. Oh and your manifest file Here's mine
REM creates the jar files jar -cvfm server.jar c:\devexam\manifest\server\manifest.mf suncertify\db\*.class suncertify\help\*.class
jar -cvfm client.jar c:\devexam\manifest\client\manifest.mf suncertify\client\*.class suncertify\db\*.class suncertify\help\*.class REM. then remove the server files not needed
Hope that helps Mark [ February 18, 2002: Message edited by: Mark Spritzler ]
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
What about your manifest file, what does it say? This is what tells where the main class is in the jar file. Mark
Steve Marks
Greenhorn
Joined: Feb 09, 2002
Posts: 15
posted
0
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
Steve Marks
Greenhorn
Joined: Feb 09, 2002
Posts: 15
posted
0
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. Thank for your help Mark...
you should be able to run the program in any directory?
Yes exactly. Which to me means you can put your jar file into any directory, go to that directory and run it using the java -jar server.jar. Which is what you have. Mark