Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago .Java is one of my programming languages of choice. I always run into the problem though of distributing my application to end-users. Giving a user a JAR is not always as user friendly as I would like and using Java WebStart requires that I maintain a web server. What's the best way to distribute a Java application? What if the Java application needs to install artifacts to the user's computer? Are there any good Java installation/packaging systems out there?
81.3k 73 73 gold badges 269 269 silver badges 376 376 bronze badges asked Sep 17, 2008 at 4:50 Laplie Anderson Laplie Anderson 6,409 4 4 gold badges 34 34 silver badges 37 37 bronze badgesJava WebStart can be used off any URL such as a file system like a CD or network drive. Granted it doesn't give you as much. Note: eclipse doesn't use an installer, you just unpack it and run it. Perhaps you don't need an installer.
Commented May 10, 2009 at 18:38These days it is very simple to deploy such a Java WebStart application to e.g. Google Application Engine.
Commented Jan 10, 2013 at 14:42It's a shame that this question is closed. I disagree with the reason stated 'as primarily opinion-based'. The answers provided are not based on opinion but on experience. I always welcome good answers based on experience. Those who cannot learn from history are doomed to repeat it.
Commented Dec 22, 2015 at 20:18You can use jlink (introduced with JDK 9) to distribute Java Apps. It comes with the JDK. It will build a dedicated JRE for you. You do not need to have java installed on client machines.
Commented Apr 25, 2019 at 9:38There are a variety of solutions, depending on your distribution requirements.
Just a note on Webstart: As long as the user has a version of Java installed that's not from the stone age (e. g. 1.2) webstart can be told to download and install a newer Java version of the one you require for your program is not there yet. Look at the .jnlp file syntax. Of course it still quite prominently displays that you are using Java which might be inappropriate depending on the clients you deal with. In those cases you should indeed some sort of "native" installer/file format and hide the implementation details as far as possible.
Commented Jun 23, 2009 at 8:59I don't like Webstart. It has too much Java/Sun branding. It's hard to get it to work right. Setting up the code signing is more trouble than it's worth and the user doesn't understand the security benefits and messages anyway. If you want to do anything on the users system you're going to have to pay for your code signing certificate to get rid of the scary warnings It does a lot of complicated caching which can cause problems. Maybe OSGi or upcoming Java modules will offer similar auto update benefits. I use a variation of #2 and create DMG/Packager for mac all from Ant.
Commented Nov 1, 2009 at 5:17 I used NSIS as you suggested. I also looked at launch4j. Why do you recommend using both? Commented Oct 27, 2010 at 14:05@JackN NSIS is an installer generator. Launch4j is specifically for making it easier to launch/start java programs. There is some overlap in their functionality, but they're targeted to different parts of the problem.
Commented Nov 8, 2010 at 14:14+1 great answer. Do you have any experience with Excelsior JET? Does it only support x86 architecture and unable to load realtime jar library?
Commented Nov 22, 2011 at 18:35advanced installer makes it easy to package java apps as windows executables, and it's quite flexible in the way you can set it up. I've found that for distributing java applications to windows clients, this is the easiest way to go.
answered Sep 17, 2008 at 6:45 rustyshelf rustyshelf 45.1k 37 37 gold badges 99 99 silver badges 104 104 bronze badgesJSmooth is a simple program that takes your jar and wraps it up in a standard windows executable file. It comes with a simple GUI that allows you to configure the required JVM, bundle it with the application or provide an option to download it if it's not already installed. You can send the exe file as is or zip it with possible dependencies (or let the program download the extra dependencies from the net on startup). It's also free, as in beer and speech, which may (or may not) be a good thing.
answered Sep 21, 2008 at 20:10 2,884 3 3 gold badges 24 24 silver badges 38 38 bronze badgesIf it's a real GUI-having end user application you should ignore the lanaguage in which you wrote the program (Java) and use a native installer for each of your chosen platforms. Mac folks want a .dmg and on windows a .msi or a .exe installer is the way to go. On Windows I prefer NSIS from NullSoft only because it's less objectionable than InstallShield or InstallAnywhere. On OSX you can count on the JVM already being there. On Windows you'll need to check and install it for them if necessary. Linux people won't run Java GUI applications, and the few that will, know what to do with an executable .jar.
answered Sep 17, 2008 at 5:00 Ry4an Brase Ry4an Brase 78.3k 7 7 gold badges 149 149 silver badges 169 169 bronze badgesreally? linux people won't run gui applications? then i guess his program is useless to them rendering the whole discussion moot.
Commented Aug 31, 2012 at 12:38@Matt why are you assuming the original application was a GUI application? I've installed many command line java applications on Linux, and the ones that come down as .deb or .rpms are especially appreciated.
Commented Aug 31, 2012 at 19:15The original title said GUI. Furthermore, if webstart has been brought up, it's a good bet it's a gui application. Finally, to say linux users don't use GUI applications is entirely untrue.
Commented Sep 1, 2012 at 4:10I didn't say linux people don't run GUI applications. I said they won't run "Java GUI" applications, and outside of NetBeans and Eclipse (which I covered under the "few that will, know what to do with an executable jar") I can't think of a single widely used Java application on Linux (Open Office, etc. are C++ and use Java only for plugins).
Commented Sep 2, 2012 at 15:30ever heard of SQLDeveloper? Or any of the oracle management tools? All coded in java (though sqldeveloper ends up being bundled as an .exe, but it's java)
Commented Sep 2, 2012 at 20:09It depends on how sophisticated your target users are. In most cases you want to isolate them from the fact that you are running a Java-based app. Give them with a native installer that does the right thing (create start menu entries, launchers, register with add/remove programs, etc.) and already bundles a Java runtime (so the user does not need to know or care about it). I would like to suggest our cross platform installation tool, BitRock InstallBuilder. Although it is not Java-based, it is commonly used to package Java applications. It can be easily integrated with Ant and you can build Windows installers from Unix/Linux/Mac and the other way around. Because the generated installers are native, they do not require a self-extraction step or a JRE to be already present in the target system, which means smaller installers and saves you some headaches. I also would like to mention we have free licenses for open source projects
answered Jan 18, 2009 at 12:07 Daniel Lopez Daniel Lopez 3,375 2 2 gold badges 32 32 silver badges 29 29 bronze badgesAlthough I haven't used NSIS (Nullsoft Scriptable Installer System) myself, there are install scripts that will check whether or not the required JRE is installed on the target system.
Many sample scripts are available from the Code Examples and Real World Installers pages, such as:
(Please note that I haven't actually used any of the scripts, so please don't take it as an endorsement.)
answered Sep 19, 2008 at 12:57 161k 35 35 gold badges 212 212 silver badges 227 227 bronze badgesexecutable files are best but they are platform limited i.e. use gcj : http://gcc.gnu.org/java/ for linux to produce executables and use launch4j : http://launch4j.sourceforge.net/ to produce windows executables. To package on linux you can use any rpm or deb packager. For win32 try http://en.wikipedia.org/wiki/Nullsoft_Scriptable_Install_System
answered Sep 17, 2008 at 4:55 249 1 1 gold badge 2 2 silver badges 5 5 bronze badgesI needed a way to package my project and its dependencies into a single jar file.
I found what I needed using the Maven2 Assembly plugin: Maven2 Assembly plugin
This appears to duplicate the functionality of one-jar, but requires no additional configuration to get it going.
answered Sep 26, 2008 at 21:37 David Carlson David Carlson 1,461 2 2 gold badges 18 18 silver badges 18 18 bronze badgesFor simple Java apps I like to use Jar's. It is very simple to distribute one file that a user can just click on (Windows), or
java -jar jarname.jar
IMHO, jar is the way to go when simplicity is a main requirement.
answered Sep 17, 2008 at 4:55 138k 53 53 gold badges 297 297 silver badges 326 326 bronze badges Try this on newbies and you'll find it won't work well. – user401247 Commented Apr 27, 2018 at 19:47 That's how Minecraft was distributed, a few years back. Commented Oct 5, 2020 at 14:34I develop eclipse RCP applications. Normally to start an eclipse application an executable launcher is included. I include the java virtual machine inside the application folder in a /jre sub directory to ensure that the right java version will be used.
Then we package with Inno Setup for installation on the user's machine.