hi all, I know that this can be done. I want the user to set the classpath to the enclosing jar file. The other jar files s'd be automatically be available. What s'd i specify in the manifest file? Encloser.jar -- a.jar (specifies the main in it's manifest) -- b.jar Now i want the user to set the classpath to Encloser.jar and say java -jar Encloser.jar ==> This s'd result int he main class inside a.jar to execute. How can this be done. Can someone supply me the manifest of Encloser.jar thanks in advance, karthik.
A jar file is just a zipped file that maintains the subdirectory structure. Inside Encloser.jar you have a set of subdirectories. Some of them contain other jar files that are just a futher breakdown of subdirectories. In the end the Encloser.jar has to have a manifest file that names the .class file in a.jar to kick off, with the complete subdirectory location spelled out - starting from the location that Encloser.jar is in. And get rid of the Manifest in a.jar. You will confuse the rest of us.
"JavaRanch, where the deer and the Certified play" - David O'Meara
i c'dnt get that to work :-(. So i have a final.jar which in turn has some jars inside it + directory structures / files etc. So i had to ask the client to extract the enclosing jar file. One more thing i found out while working with executable jar files : I posted it in the ranch but no one has has confirmed it as yet in the forum. the class-path setting is immaterial when using executable jar files. IF the executable jar refers to other jars, then we normally have a Class-Path attribute in the manifest. So depending upon this attribute setting the other jars are searched. Class-Path: another1.jar another2.jar another1.jar and another2.jar will be searched only in the same directory as the executable jar file. Explicit classpath settign does'nt help. if we say (in manifest), Class-Path: .\folder\another1.jar .\folder\another2.jar then it w'd search in folder named "folder" relative to the location of the executable jar file. I c'd'nt digest it early on that i c'd ship an application that did'nt need a classpath setting! Just make sure that the dependent jar files are in the same folder as executable jar file or in a specific subfolder relative to the executable jar. Am still waiting for responses though. My application works just fine. karthik.
Originally posted by Cindy Glass: You know, now that I think about it, I have never really SEEN a jar file inside another jar file - and I have surely never tested to see if it works. Tell us how it works out.