This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
This is more of a Jar question, but since I'm using ANT's jar task to do this maybe someone can help. Can you jar jars? I mean, if you're building a final deployable, double-clickable jar file, and you want to jar up all your own compiled classes, PLUS all the jar libraries you're using in one jar file, can you do that? When I jar all my classes and jars, I can verifiy in WinZip that they have in fact all been added. And I've added a Manifest so I can double-click the jar file and it launches and starts my Java app. BUT, the problem is, that my classes don't see *any* of the imbeded jar files. So I don't know #1, if you can jar jar files, or #2, if you can, what you have to do to get your classes to see them...how do you specify a classpath to include jars already inside the main jar file?? Thanks!
Try adding the classpath attribute to your manifest.
Joined: Jan 07, 2002
Yes,I've done that. All the jars inside my main jar are included in the manifest classpath. However, none of the nested jars' classes are visible to any of my classes even after doing this. [ April 06, 2002: Message edited by: Rob Ross ]
You could but, you'd have to create your own custom classloader and load it into the outer most jar file. Your other choices are to 1)unjar the files from the others jars and include them in one jar. 2) create your jar with the appropriate entries for Main-Class and Class-Path with the other jars in the same directory. Create an install class which unpacks the contents of the final jar. Include that class and all jars in another jar. When it is run, it unjars all your jars and makes your project ready to run.
Originally posted by webaesthet: I think this is how it works: Add classpath in the Manifest and change all your code to use <object>.getClass().getResourceAsStream() method, which can load a file from within a jar.
Welcome to the JavaRanch! Please adjust your display name to meet the JavaRanch Naming Policy. You can change it here. Thanks! and welcome to the JavaRanch!