Can a non-executable (ie class library) JAR file contain other JAR files?
Joined: Feb 12, 2009
Is it possible for a non-executable (i.e. class library) JAR file to contain other JAR files (its dependencies perhaps) inside it? Perhaps bundled up inside a lib/ sub-directory?
Here is what I am trying to do:
I have an existing class library, mylib.jar.
I want to modify one class (e.g. MyClient) from mylib.jar by overriding a couple of its methods, and provide this modified version (MyNewClient) in the new JAR mynewlib.jar.
But I want the end result to be a single jar file that can be used as is without needing to include mylib.jar on the CLASSPATH.
So I just want my users to be able to say:
javac -cp mynewlib.jar MySource.java
instead of needing to reference the original mylib.jar as well on the CLASSPATH.
Is this possible?
I've spent some time with both Eclipse and Netbeans and this doesn't appear to be possible for non-executable Jar projects.