Hi All, I am trying to create a batch script that puts an executable jar file in the classpath so that I can execute the jar from any directory. If I start the application from the directory the jar file is in, like this: java -jar Program.jar, it starts fine, but if I am in a different directory, I get "java.util.zip.ZipException The system cannot find the file specified." I also tried putting it in the system classpath, but that also does not work. I have never had this problem before with other jar files that were NOT self executing (in other words, the main class not defined in MANIFEST.MF) So, I was wondering if it had something to do with the fact that this one I am trying to run is self executing. Has anyone else ever experienced this? Thanks for your help!
Barry, I believe your problem may be that in a command line like: java -jar whatever.jar the value to the -jar option is not searched for in the classpath. If your main() routine resides in a class with a unique package signature (it should), you might have better luck with: java your.package.name.Main in which the named class will be searched for in the classpath. Of course, you lose all the benefits of using a manifest file in the jar with this approach. I don't know of any means to specify a search path for values on the -jar option. Too bad, that'd be very convenient. Perhaps that's why so many java programs are started via shell scripts. hth, bear