Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Linux Installer for a Swing Application

 
Dem Pilafian
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dem Pilafian
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

I don't know where to put the icon by default.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18014
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dem Pilafian
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18014
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah. You might want to look here: http://argouml.tigris.org/ to see how it's done.

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.
 
James Kline
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just chequed the debian package list and found there is a Debian package called

make-jpkg

whose description is:

This package provides the capability to create a debian package from
a Java(TM) 2 distribution by just running make-jpkg <filename>.

Don't know if you have a running GNU/Linux OS at hand, but you can have one for free. After that adding the new package is extra simple.
 
James Kline
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, make-jpkg is the name for the command, the actual name of the packet is

java-package
 
Dem Pilafian
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like make-jpkg is for installing the JRE. I did a bit of searching but could not find any way to apply make-jpkg to a Java application (executable JAR).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic