Well - actually you can - and that is the preferred way of creating jar executables.
What you can do is extract the jar using winzip or 7zip - then merge them with your own jar / classfiles and create a new jar file. You also will have to create a manifest file that tells which is the main class - the class to execute (the main method) when the jar is executed.
Then anybody can just execute the jar file using
java -jar yourfile.jar
If you use Ant to build your projects all these steps can be automated...
Anoop
Main Topics
Browse All Topics





by: gripePosted on 2007-01-15 at 09:23:14ID: 18317583
You can't actually include jars as class resources in another jar (at least in the sense that you mean). You could do one of several things to work around it:
s.org/uber jar.html)
1. Don't try to include other jars in your jar and just add them to a 'lib' directory and update the jar's classpath to point there. (IE: ./lib)
2. Store the included jars in their extracted form
3. Write your own ClassLoader (Or use someone else's) that can understand how to do what you want to do. (Example: http://classworlds.codehau