JarSplice - The Fat Jar Creator

-Introduction
-Features
-Screenshot
-Download
-Frequently Asked Questions
-History

Introduction
Deploying Java Applications can be a pain if your application has multiple jars and native libraries. There are the options of using Java Web Start or Java Applets however these are not always suitable.

Executable Jars are an option, however if your project has multiple jars or native files then it can be tricky to use this option.

JarSplice attempts to solve this issue by allowing you to merge all your jars and native files into one, easy to use executable jar file.

Features

  • Creates a single executable fat jar via an easy to use GUI.
  • Automatically extracts only the native files needed for the OS the jar is running on.
  • Automatically cleans up any extracted native files after the application quits.
  • Add VM arguments on jar creation which removes the need to enter them via the command line.
  • Optionally create a Shell Script (*.sh) launcher for Linux with embedded fat jar.
  • Optionally create an OS X App Bundle (*.app) for running your application.
  • Optionally create a Windows Application (*.exe) for running your application.

Screenshot

Download
JarSplice-0.40.jar (135.8kb Executable Jar)

Frequently Asked Questions
Q. What License is JarSplice under?
A. JarSplice is free to use for any type of application. The source code for the actual JarSplice application will be under a BSD Licence. Anything produced with JarSplice remains under the same licence as the input.

Q. Does JarSplice create Jar files from source/class files?
A. No, you must put your project files into a jar file before using JarSplice. Most IDE's have this feature built in and allow you to export your class and resource files to a jar.

Q. Does JarSplice create Windows Executables (*.exe files)?
A. While the Executable Jar files (*.jar) produced by JarSplice run on windows just by clicking them you may want an exe files instead. Exe files have a slight advantage in that you can associate an icon with them and that end users are more familiar with running them. Tools such as Launch4j or JSmooth can produce exe files that can wrap or launch jar files. If you create the executable jar with JarSplice you should be able to wrap it into a single exe file, alternatively you can just include an exe launcher with the jar file so that end users on linux and mac can also start the jar file from the same bundle.

Q. How do you create *.icns icon files for use with OS X .app bundles?
A. This is the Apple Icon Format used by OS X for App Bundles. Many image editing tool like the GIMP and Photoshop support the format. You can also use free online converters like iConvert to create *.icns file.

History
0.40 - 27/06/12 - redone parts of the GUI (fixes file dialog issues on OS X), added option for creating OS X .app bundles and Windows .exe files.
0.30 - 17/06/12 - added success/failure message on jar creation, use same jvm for app as JarSpliceLauncher
0.25 - 19/06/11 - added support for vm arguments.
0.20 - 05/06/11 - added support for creating linux shellscripts, separated core code from gui code, improved layouts on gui.
0.16 - 01/06/11 - added ability to remember last location when using JFileChooser.
0.15 - 31/05/11 - fixed problem with Windows paths.
0.10 - 22/05/11 - initial release of JarSplice.

If you have any comments, bug reports or RFE's just post them as a comment below.

Comments

Hi, while I create fat jar with jarsplice, I have got an error that is "Jar creation failed due to the following exception: duplicate entry:about.html"

how can ı solve this problem?

Thanks.
Regards.
Sercan.

Anonymous Ninja
Thu, 02/27/2014 - 21:17

check that your jars do not have duplicate entries, i.e. files with the same names, otherwise you can't merge them into one jar.

Anonymous Ninja
Thu, 02/27/2014 - 21:52

Please fix command line parameters! (I know many people have already asked).

Also, when using a command line program in the terminal in Ubuntu, the enter button does not work to enter something with a Scanner or BufferedReader. It works with just the plain jar.

Anonymous Ninja
Tue, 02/11/2014 - 00:15
Anonymous Ninja
Fri, 12/20/2013 - 21:47

if I do all this and open the .jar it shows the screen for less than 1 second. what do i do wrong?

Anonymous Ninja
Sun, 12/15/2013 - 17:14

any can tell me what are native files?

Anonymous Ninja
Mon, 12/02/2013 - 13:55

Hi Im using on Jruby FatJar GUI packaging and when i setup a splash like a normal jar it remains after class launches appears i think that is because jarsplice reaminds.
I can solve it using vm parameters but it need and stand alone splash image file near fatjar.
The idea its to package all together ...
¿Theres a way to put splash onto jar and do they die after charge, another manifest option?

Thats the app..
http://sourceforge.net/projects/rmldonkey/

Anonymous Ninja
Sat, 10/05/2013 - 16:37

It seems that JarSplice lost its ability to create .app files, probably due to my upgrade to Java7. Are there plans to patch this. It is a REALLY useful ability to have.

Thanks in advance.

Anonymous Ninja
Mon, 07/29/2013 - 21:35

could you please add support for command line parameters?
That would be so <---------------------------------------------> great!

Anonymous Ninja
Mon, 06/03/2013 - 11:39

ive made the fat jar file but it does not run when clicked on do i need something to run it please help

Anonymous Ninja
Thu, 06/06/2013 - 04:43

When is the source code going to be released? If you don't intend to release it... tell us how you include the natives into the final jar...

Anonymous Ninja
Sun, 05/19/2013 - 14:15

Does JarSplice support Java 7?

Anonymous Ninja
Sat, 05/11/2013 - 11:00

Great tool, works exceptionally well. It would be useful, though, if there was support to adding application icons for *.exe as with the Mac OS App Bundle. Something nice to have.

Anonymous Ninja
Wed, 05/08/2013 - 05:19

It would be great if one could add additional folders or files, so really all project files are in one jar. Awesome project by the way.

Anonymous Ninja
Sat, 04/27/2013 - 17:46

This is an awsome tool, takes the hustle of adding libs and natives away, butI am unable to pass program arguments and also it seems the Scanner class which allows to take input from Console gets disabled . My JAR file prompts user for input when run openly but does not show console input prompt when packaged through jarSplice.

Anonymous Ninja
Mon, 03/04/2013 - 14:17

When will the source code be available?

Anonymous Ninja
Tue, 01/15/2013 - 19:29

I LOVE YOU SO MUCH, THIS THING SAVED MY LIFE <3
But is it possible to have icons for .exe export?
AGAIN, THANK YOU FOR THIS THING <3

Anonymous Ninja
Sun, 01/13/2013 - 21:02

I modified JarSplice a month or so ago so that i could call it via cli from a build script, I contacted the author about the change however he has not responded so i might aswell release it here seeing as other people had requested it.

http://pastie.org/5631074

If you compile the above file as JarSplice.java (you will need to add the jarsplice jar to your classpath or extract the jarsplice jar and place it in org/ninjacave/jarsplice).
Once compiled open the original jarsplice jar in a program such as 7z and replace the JarSplice.class in the dir structure org/ninjacave/jarsplice.

Now you should be able to execute jarsplice as usual or with a CLI (just call it from command line with a random argument and it should list the correct usage).

I have only tested it for adding jars to jars but all functionality of the original application should be accessible through the CLI.

For anyone unable to complete the above steps i have provided a premodified version, however you are encouraged to use the above source code modification.
https://dl.dropbox.com/u/2461478/Docs/jarsplice-0.40-CLI.jar

Anonymous Ninja
Sun, 01/06/2013 - 15:16

This works great! but...
I think there needs to be an option to save/load projects.

Anonymous Ninja
Fri, 12/07/2012 - 17:21

i applied every steps but when i click to create fat jar i got same error any time
'duplicate entry: META-INF/MANIFEST.MF'
please help me

Anonymous Ninja
Fri, 12/07/2012 - 10:18

did you export as a jar or an executable jar? Open up your jar files and see if there is a manifest file already created.

Anonymous Ninja
Fri, 12/07/2012 - 17:22

they have META-INF folder and MANIFEST.MF file in it . Do you mean that ?

Anonymous Ninja
Tue, 12/11/2012 - 21:54

This is what I've been looking for! Even though my app only had one jar, this allowed me to set Xms and Xmx options without dealing with command lines.

Anonymous Ninja
Fri, 11/30/2012 - 02:41

Hello,
If i use your utility to create one single jar, will the jarsigner tool work to sign all jars within the created jar?
THanks

Anonymous Ninja
Thu, 10/25/2012 - 16:49

Hello,
I try to package my jar with your application, i added 2 jar for my database : derby.jar and derbyclient.jar (10.8.1.2).
When i create fat jar, i have the following message :
Jar creation failed due to the following exception:
duplicate entry: org/apache/derby/iapi/services/info/JVMInfo$1.class

Anonymous Ninja
Fri, 10/05/2012 - 08:39

The linux .sh files contains much junk and doesn't work. tested on ubuntu 11.04

Anonymous Ninja
Mon, 10/01/2012 - 19:45

did you make it executable? i.e. right click, properties, and 'is executable'

Anonymous Ninja
Tue, 10/02/2012 - 21:16

I found a way not to have to put all dependencies every time you want to make a fat jar.

1 You must use Maven on your project, and add the assembly plugin, which can be found here: http://maven.apache.org/plugins/maven-assembly-plugin/
1.1 Keep in mind that you MUST use the LAST version of it, the others make duplicated files that corrupt the jar

2 You also must use the libraries as maven dependencies, and not as your ide adds them.
2.1 If you use LWJGL and/or Slick 2D, I strongly recommend that you use the Maven Native Dependencies plugin, it has all the natives for both this libraries.

That's all the preparation, now let's go to making our Jar.

3 Make sure your project doesn't have any error and that it compiles successfully.

4 Use the assembly plugin's assembly:assembly goal to make a jar with it's dependencies.

5 Add the Jar with dependencies and the main-class to JarSplice. That should be all you ought to do.

The Fat Jar JarSplice makes should be fully executable.

The next time you want to make a fat Jar you just have to start from the 3rd step. This way, Maven deals with adding all the dependencies, and you just have to define which is the main class.

Hope this helped,

Aritzh

PS: If someone knows how to make Maven put the Main class with all this plugins, send me a mail to aritzjava@gmail.com because I haven't managed to do it.

Anonymous Ninja
Thu, 08/30/2012 - 10:18

Command line argument passing would be great for automated build processing. For example, arguments containing locations for the jars, natives, main class, and output could be passed to the VM and automatically dealt with as an alternative to using the GUI each and every time a distributable jar in need of being generated using this tool. I would have done this myself, but it doesn't appear as though the source is available.

Anonymous Ninja
Thu, 08/30/2012 - 05:27

Command Line support will be part of the next release, source should follow shortly after that.

admin
Thu, 08/30/2012 - 19:53

Where's the BSD licensed source?

Anonymous Ninja
Thu, 08/30/2012 - 05:14

Can you please add ability to save/load all settings, so when I want to recompile just press Create Fat Jar button and it's done?

Anonymous Ninja
Thu, 08/02/2012 - 17:13

What do you add as your main class path?

Anonymous Ninja
Mon, 06/25/2012 - 16:22

The main class (and package) of your application!

Anonymous Ninja
Tue, 06/26/2012 - 19:31

Thank you for the wonderful application you have made.......
I hope it is just what everyone will be looking for who does not know ANT script, etc etc.....
This makes life life so much easier...
Tank you once again.

Anonymous Ninja
Sat, 06/23/2012 - 18:34

This is very helpful but It would be very nice if it would have a message telling me when it finished making the jar. Since I want to test my Program out as soon as possible, I would like to know when the jar is ready instead of waiting for until I assume it's done, and If I click too early it says corrupt jar and I have to recreate it and wait again.

Anonymous Ninja
Wed, 06/13/2012 - 00:48

noted, will try get this in next release.

edit: added in the JarSplice 0.30 release.

admin
Wed, 06/13/2012 - 19:28

Please, add the CLI/ANT support ASAP, we'd love it!

Anonymous Ninja
Tue, 06/12/2012 - 17:15

Since I don't see the subject, the post below is asking about user entered command line parameters, static data.

Anonymous Ninja
Tue, 06/12/2012 - 14:56

Is this possible with JarSplice? It's a pretty big part of executable jars....

Anonymous Ninja
Tue, 06/12/2012 - 14:55

how do you pass command line args to the inner jar file? Seems no way to do this. Please fix or release src.

Anonymous Ninja
Thu, 05/17/2012 - 09:24

Hello,
is the source code available? I would be interested in finding out how the tool works and doing some modification...
Greez,
Lukas

Anonymous Ninja
Wed, 05/09/2012 - 20:48

worked flawlessly for me first time of asking. Definite plus-one for non GUI interface to it though. Would be better shipped as a lib that a GUI, CLI or Ant Task could use as a dependency. Thanks for making it available though.

Anonymous Ninja
Wed, 05/02/2012 - 11:51

Hi Thanks for the wonderful tool

Anonymous Ninja
Tue, 04/10/2012 - 13:30

Hi i found its a good tool

Anonymous Ninja
Tue, 04/10/2012 - 13:29

Hi! Thank you for this useful tool! I've a suggestion to improve the native section: suppose I've two native libraries for two different OS (Linux, Windows). Each native lib has 32 and 64 bit version. It would be great to map which library launch at runtime depending on the current OS. I would package all native libraries for all supported OS in every case, it's the drawback of this kind of solution but could be acceptable. So the native section would have, let's say, 4 textfields:

Windows x86 library(ies) path: ..............
Windows x64 library(ies) path: ..............
Linux x86 library(ies) path: ......…
Linux x64 library(ies) path: ......…

Than the generated launcher will load into -Djava.library.path the appropriate native libraries depending on current OS which the application is running on.

Anonymous Ninja
Thu, 03/29/2012 - 15:31

How can I use JarSplice in an ant build? Will this be supported?

Anonymous Ninja
Wed, 03/21/2012 - 19:29

atm you can't really use it with ANT, since its gui only, however there are plans to add command line and ANT support soon.

admin
Wed, 03/21/2012 - 21:40

One more vote for cli-version!

Thanks for this, and all the tutorials also :)

Anonymous Ninja
Mon, 04/16/2012 - 07:12

tried jarSplice, but cant get it to find my main class. can someone give me the step by step rundown starting from the native code to the finished product?

Anonymous Ninja
Fri, 01/20/2012 - 23:09