Any suggestions or tutorials out there for how to create a Linux installer for a standalone Java (116 KB executable jar) application? My application has a Swing UI and can be launched and run by simply double-clicking the JAR file, but I still need an installer to make distribution to my users easier. I already created installers for Mac OS X and Windows, but finding out how to create an installer for Linux is proving rather frustrating.
Details: 1) It would be nice if the installer file launched with a simple double-click. 2) After installation, the application (or launcher) should have an icon. 3) I do not want to include the JRE in the installer. 4) My application has no dependencies other than needing a JRE. 5) Ubuntu Linux is my first priority, which I think uses ".deb" files (Debian) instead of ".rpm" files (Red Hat). 6) Upgrades are not important -- it's ok to do a full reinstall each time. 7) Java Web Start is cool, but it's not appropriate for my target audience. 8) My application is completely free (no adware or other nasties), so the installer also needs to be free.
Yes. Unfortunately, those solutions result in huge installers (they include a copy of the JRE). That's fine for enterprise software and such, but my program is fairly small. Both my Mac installer and my Windows installer are each only about 15% larger than the jar file they include.
It would seem that creating a simple .deb file to install an application on Unix should be easy. However, it seems that .deb files (and .rpm files) are really only appropriate for installing OS components.
I guess a problem will be to adress the different window-managers, like KDE, Gnome, ... Don't they have different approaches, to put an icon on the desktop?
To make things a bit more complicated, some users (like me) refuse desktop-icons at all. (I'm using fluxbox and never missed an icon.)
What does the user need? He needs your jar with manifest and Main-class: entry. He needs a startscript, which finds the jar, and does a
and he needs the icon, to link it to the script, if he likes to make a shortcut on the desktop.
The shell-script should be found in the PATH for command-line-junkies. You could suggest to put it to /usr/local/bin and to put the jar to /usr/local/lib, and ask the user to confirm, or specify a different location.
Out of curiosity, why isn't Java Web Start appropriate? If they've already got the JRE installed, that would seem to be the simplest way - it's already bundled in modern JRE implementations.
An IDE is no substitute for an Intelligent Developer.
Joined: Nov 09, 2005
Tim, I'm all for Web Start taking over the desktop. Web Start holds a lot of promise, but at this time it's not a high priority for me because:
1) Learning Curve For the corporate environment where IT needs to push out a large number of application updates to everyone in the company, Web Start makes a lot sense. However, my target audience is just individual users (who are unlikely to be Web Start users), and getting users to understand and adopt Web Start just for my tiny application would be a challenge.
2) Usability I've experimented with Web Start, and it seems a bit clunky. Maybe the Mustang (Java 6.0) release will make it more appealing.
3) I'm Lazy I actually tried, but I encountered a java.lang.reflect.InvocationTargetException error (if you're curious, see: "http://www.snapbackup.com/download/webstart.html"). My application requires Java user preferences and writes to the disk, but Web Start does not seem to like that.
It's a little tricky, because they say to download JWS. Ignore that, if you're running a recent (1.3+) sun jre, since JWS is already part of those releases.
Under FireFox/Windows, it wants to download the jnlp file (double-click the downloaded jnlp file to launch it) instead of launch directly. Under IE, it will launch directly.
JNLP file format is pretty straightforward.
There's really only one caveat: JWS is designed to download (if needed) and run the latest&greatest version of the app. So if you present a latest and greater version that's broken, it will download and overlay an older working copy.