23

I have a Java .jar application that I want to distribute to my clients who are on Macs or Windows. I want to use a tool that takes my jar file and wraps it in a .dmg and a .exe wrapper for Macs and Windows respectively that does this when run:

  1. Checks if JRE is installed; if not, it installs JRE6 from Oracle. Else, it updates installed JRE to latest 1.6.x version.
  2. Creates a short cut link in Start Menu (in Windows) or the Applications folder (in MacOSX) to my wrapped application and lets my application to run using the above JRE
  3. Supports easy "uninstall application" for Windows. For Mac, simply drag the .app to Trash to delete.

Optional features:

  1. Support for platform independent app icons
  2. Support for auto updates to the jar
  3. Support for arguments to the JRE when running my .jar
  4. Linux support (.deb or .rpm)
pathikrit
  • 32,469
  • 37
  • 142
  • 221
  • 1
    I feel that Package Maker and Advanced Installer can do everything you're asking for. I don't think you're going to find one tool that will work for both Windows and Mac. You'll probably need something separate for package management. If you tell us which of your requirements have not been met by Package Maker, Advanced Installer, or whatever you've tried, we can probably help. – jahroy Jun 24 '12 at 01:57
  • Note that jre 1.6 is only available as a download and software update from Apple. 1.7 is available from Oracle. – mmmmmm Jun 26 '12 at 22:53
  • I do not know what your budget is, but have a look at: [Flexera Software's InstallAnywhere](http://www.flexerasoftware.com/products/installanywhere.htm) – msiyer Jun 27 '12 at 12:59

6 Answers6

9

Check out Package Maker for Mac and Advanced Installer for Windows.

I've used them both for just about every requirement you've listed.

I haven't used them for auto-updates, but you probably have to build that logic into your app.

Don't expect them to do ALL of the work for you, though.

Expect to spend quite a bit of time building an installer for each platform.

I'm sure there are lots of options for Windows and Linux. Advanced Installer just happens to be the only one I've used.

I believe Package Maker is the standard for Mac. It's pretty awesome and easy to use.

Good luck!

jahroy
  • 22,322
  • 9
  • 59
  • 108
1

For deploying on Windows, I like using Launch4j for wrapping my application jar and creating a native Windows executable that can detect and use an already installed JRE, or allows you to bundle your own. It's fast, lightweight and easily scripted with Ant (or Maven) as part of your build process.

Combined with this, I typically use NSIS for creating an installer that puts in shortcuts, and allows install/uninstall/repair from Control Panel. With a bit of work, this can also be scripted via Ant, and can also be built from a Linux platform.

These solutions obviously won't work for Mac deployment, but I suspect you'll have to use different tools for the different platforms if you want the best experience for the end users.

wolfcastle
  • 5,850
  • 3
  • 33
  • 46
1

I have researched this for a while so that I can install the application in Linux and Windows. The best alternatives I found were -

You can find information how to use it native in this blogpost. But installing it in Linux got me to use a .sh script. As for mac my knowledge is limited. Hope this helps.

Chan
  • 2,601
  • 6
  • 28
  • 45
1

Note that if you develop your application as a netbeans platform application, then netbeans will produce cross platform installers for you (including for mac).

The fact that its a netbeans application has little impact on the look and feel of the app, you can still make it behave pretty much the same as any stand alone swing app.

This has the following advantages, which i think makes it a compelling option: - cross platform - its free - does not require a JDK to be installed prior to running the installer - integrates a software update process

Brad at Kademi
  • 1,300
  • 8
  • 7
1

There are already some good answers, but I guess JavaWebStart needs to be mentioned. Of course, it is only suitable for web deploment, but after installation Your application may also run offline.

The features (auto update, JVM version check, Desktop icon) are available.

Things to consider:

  • Your application needs to be singed to have access rights like a "normal" application.
  • afaik You cannot ship Your application on any other way than per web download.
Black
  • 5,022
  • 2
  • 22
  • 37
1

Java Runtime Environment (JRE) is gone since JDK 11.

JDK 11 Release Notes states -

In this release, the JRE or Server JRE is no longer offered. Only the JDK is offered. Users can use jlink to create smaller custom runtimes.

u/0x256 on Reddit has a great comment regarding this issue:

There is no separate JRE anymore, only the JDK which includes all JRE parts (e.g. the java binary). Also, do not use OracleJDK unless you intend to pay them money. OpenJDK is the new default.

You can use jlink (which comes with the JDK) to distribute Java Apps. It will build a dedicated JRE for you. You do not need to have java installed on client machines.

An oracle blog article mentioned that -

Using the ‘jlink’ tool introduced with JDK 9 will make it even easier for application developers to package and deploy dedicated runtimes rather than relying on a pre-installed system JRE.

Edric
  • 24,639
  • 13
  • 81
  • 91
Ahmad Ismail
  • 11,636
  • 6
  • 52
  • 87