-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.
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
could you please add support for command line parameters?
That would be so <---------------------------------------------> great!
ive made the fat jar file but it does not run when clicked on do i need something to run it please help
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...
Does JarSplice support Java 7?
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.
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.
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.
When will the source code be available?
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
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
This works great! but...
I think there needs to be an option to save/load projects.
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
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.
they have META-INF folder and MANIFEST.MF file in it . Do you mean that ?
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.
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
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
The linux .sh files contains much junk and doesn't work. tested on ubuntu 11.04
did you make it executable? i.e. right click, properties, and 'is executable'
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.
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.
Command Line support will be part of the next release, source should follow shortly after that.
Where's the BSD licensed source?
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?
What do you add as your main class path?
The main class (and package) of your application!
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.
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.
noted, will try get this in next release.
edit: added in the JarSplice 0.30 release.
Please, add the CLI/ANT support ASAP, we'd love it!
Since I don't see the subject, the post below is asking about user entered command line parameters, static data.
Is this possible with JarSplice? It's a pretty big part of executable jars....
how do you pass command line args to the inner jar file? Seems no way to do this. Please fix or release src.
Hello,
is the source code available? I would be interested in finding out how the tool works and doing some modification...
Greez,
Lukas
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.
Hi Thanks for the wonderful tool
Hi i found its a good tool
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.
How can I use JarSplice in an ant build? Will this be supported?
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.
One more vote for cli-version!
Thanks for this, and all the tutorials also :)
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?
try asking in the #lwjgl irc channel, someone there might be able to help http://webchat.freenode.net/?channels=lwjgl
This executable jar approach has made distribution much easier for me, but embedding my LWJGL games in a web page is still desirable. Is this possible with the jars that Jarsplice produces (to your knowledge) or do I need to go back to wading through applet bugs?
The JarSplice jar can't be embedded into a webpage, you need to write your application as an applet and then use something like LWJGL's AppletLoader to deploy it.
Hi Kappa,
just gave it a try with my Slick competition entry and at least for Windows it worked like a charm! Can't test on other platforms though.
One improvement suggestion: The file dialogs should remember the last used directory (jars and native libs are very often in directories nearby...).
In the Slick forum you mentioned you would think about adding an .exe file for Windows, an .sh for Linux and a Mac package. I think that would be a cool feature to add!
Cheers,
Tommy Haaks (www.rightanglegames.com)
hey guys, i've been working on a 2d game using lwjgl for 4 months now. it's due in a week and i cannot for the life of me get it to compile into a single jar. i've tried multiple tools and it keeps telling me my main class cannot be found.... any help please?
what are you entering for the main class?
Added the ability to remember the last used directory when using the file dialog. Up next hopefully I'll add .sh support for linux.
the size of the final jar exported from jar splice, is very big,
i made a simple program that uses slick and lwjgl,
the size of final fat jar is 5,72 MB , witch is too big
i have a jar from the internet that have much more graphics, classes, pictures etc. and have only 497 KB
how can i use jar splice but at the same time make jars small sizes?
thanks