tags:

views:

1836

answers:

7

my application needs multiple jars to work. Since it is a desktop application i can not hold the user responsible of installing. So in my build script i unzip the jars content in to my build directory delete manifest files, compile my software and jar it again. Everything works as it should my question is are there any long term side effects to this process?

A: 

If some of the jars are signed you loose the signature by unpacking/repacking it.

asalamon74
A: 

Well you're throwing away the MANIFEST of your third party jars, so that could cause you problems. For example you could be causing security issues by throwing away the "Sealed" attribute.

Why not just create a simple installer and a script to launch your application which sets the CLASSPATH correctly?

Glen
+5  A: 

In the past, there were JARs with weird content (like the DB2 driver which contains com.ibm and com.IBM; after decompressing in a Windows filesystem, those two packages would be merged).

The only issue you need to be aware of are signed jars and other files in META-INF which might have the same name in multiple source JARs.

A simple solution for all these issues is to use One-JAR. It allows to wrap several JARs into one without unpacking them, first. And read this answer: http://stackoverflow.com/questions/81260/java-easiest-way-to-merge-a-release-into-one-jar-file

Aaron Digulla
+1  A: 

If you want a no fuss way for the end user to kick off a program with multiple jar dependencies you may want to look at Launch4j or Jsmooth (I prefer Launch4j). Both are programs that create executables that wrap jar(s) and the JRE together so that to the end user it appears no different then any other executable.

James McMahon
A: 

Another great option is ProGuard, which can also shrink and/or obfuscate the code too.

Software Monkey
A: 

If your primary target platform is Windows desktop, then you could also consider generating an Windows native exe from the jars of your application

swamy
A: 

One-JAR will do the job, and has a new release (0.97) which supports frameworks like Spring and Guice, which users are now packing into One-JAR archives. http://one-jar.sourceforge.net

Ference Hechler also did some great work inside Eclipse with the Eclipse export wizard: we worked together on FatJar/One-JAR from which the Eclipse work grew, and I can recommend that as an approach, though I don't know how well it handles the frameworks.

simontuffs