JDK-6349851 : Allow jar library files inside another jar.
  • Type: Enhancement
  • Component: tools
  • Sub-Component: jar
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2005-11-14
  • Updated: 2010-05-24
  • Resolved: 2010-05-24
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE REQUEST :
I have a java app A that uses jar libraries B and C.

I want to deliver A.jar as a single file for easy delivery and deployment, that can be run using a single command: "java -jar A.jar"

Unfortunately, there seems to be no simple method to do this. Unpacking B.jar and C.jar before creating A.jar might violate a licence on B.jar.  The manifest classpath can't be set to do this.

In fact, the only solution seems to be a custom classloader. This problem should not be so difficult. It's the most natural thing in the world to want to deliver your app as a single file, and we now have no method to do this.



JUSTIFICATION :
Enough developers want this to have someone write a popular solution named One-Jar. (http://www-128.ibm.com/developerworks/java/library/j-onejar/ ) In fact, it is so popular that it was integrated with FatJar Eclipse Plugin.

Please fix this - this is a real problem for many developers.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I expected a jar inside a jar file to correctly load it's classes.
ACTUAL -
I get assloads of NoClassDefFoundErrors and no simple way to fix it.

---------- BEGIN SOURCE ----------
Include any supporting jar file inside an application jar. Files in the internal jar can't be loaded.
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Get Eclipse and use FatJar Eclipse Plugin, or write your own custom classloader.