7

I want to produce executables for other platforms for a Java utility.

I found Launch4J which produces a nice package for Windows, but I'd also like to find something similar that produces the same kind of a thing for Mac users and Linux users.

This isn't for security or code protection but more as a convenience. I really want to accomplish a relatively easy set of tasks:

  1. Find and leverage an existing Java installation.
  2. Apply some default command line parameters
  3. For GUI applications, suppress any console display
  4. Ideally, have the application show up and be recognizable in whatever the equivalent of windows task manager is (i.e. myapp.exe instead of java.exe or javaw.exe)
  5. Apply my own custom icon to the launcher.

Is there a utility that produces cross platform executables or shortcuts? Launch4j runs cross platform but only produces windows executables as far as I can tell.

Steve Kallestad
  • 3,134
  • 2
  • 20
  • 30

3 Answers3

3
  1. For deploying Java desktop apps., the best option is usually to install the app. using Java Web Start. JWS works on Windows, OS X & *nix.
  2. The best way to deploy a JWS app. or applet is to use the Deployment Toolkit Script. (Addressing your point of 'Find and leverage an existing Java installation'.
Community
  • 1
  • 1
Andrew Thompson
  • 163,965
  • 36
  • 203
  • 405
2

Here are some possibilities:

The other approach is to use something like Install4j to generate installers for multiple platforms and have that take care of the launcher problem for you.

Finally, the launch4j site says this:

"Running Launch4j on other Java enabled platforms is a matter of getting a binary version of MinGW binutils 2.22 (windres and ld only) for your system or compiling them. If you'll provide these, I'll be able to create a binary package available for download."


Note that a launcher does not have to be a native application (e.g. a "EXE" file) to satisfy most of your requirements.

"I just want my work to be simple to use and look professional."

Hrumph! There are many large companies that ship large (and expensive) Java-based products that don't have a native launcher. My advice: if your customers don't demand it, don't waste your time on it.

Stephen C
  • 632,615
  • 86
  • 730
  • 1,096
  • "Note that a launcher does not have to be a native application (e.g. a "EXE" file) to satisfy most of your requirements." - agreed. I just want my work to be simple to use and look professional. Thanks for your help! – Steve Kallestad Jun 11 '13 at 14:03
1

Have a look at Packr. It can wrap jar into executable for Win, Mac and Unix. Also it packs JRE inside.

Metaphore
  • 715
  • 1
  • 7
  • 15
  • I have written a maven build plugin that wraps the packr java api. The plugin is built around version 2 of packr. https://github.com/stevenmz/packer-maven-plugin – Steven Magana-Zook Feb 09 '17 at 17:28