File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Linux / UNIX and the fly likes Linux Installer for a Swing Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Linux Installer for a Swing Application" Watch "Linux Installer for a Swing Application" New topic
Author

Linux Installer for a Swing Application

Dem Pilafian
Greenhorn

Joined: Nov 09, 2005
Posts: 6
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.


<a href="http://www.snapbackup.com/translate/" target="_blank" rel="nofollow">Translate </a><a href="http://www.centerkey.com/php/" target="_blank" rel="nofollow">perfect </a><a href="http://www.centerkey.com/mac/java/" target="_blank" rel="nofollow">mac </a><a href="http://www.centerkey.com/java/browser/" target="_blank" rel="nofollow">browser </a><a href="http://www.centerkey.com/style/switcher/" target="_blank" rel="nofollow">style </a><a href="http://www.centerkey.com/colors/" target="_blank" rel="nofollow">colors</a>.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Have you looked at Zero G, InstallAnywhere?
http://www.macrovision.com/products/flexnet_installshield/installanywhere/index.shtml


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Dem Pilafian
Greenhorn

Joined: Nov 09, 2005
Posts: 6
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

Joined: Jun 02, 2003
Posts: 1923

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.


http://home.arcor.de/hirnstrom/bewerbung
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15953
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Dem Pilafian
Greenhorn

Joined: Nov 09, 2005
Posts: 6
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

Joined: Jun 25, 2001
Posts: 15953
    
  19

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

Joined: Dec 08, 2005
Posts: 6
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

Joined: Dec 08, 2005
Posts: 6
Sorry, make-jpkg is the name for the command, the actual name of the packet is

java-package
Dem Pilafian
Greenhorn

Joined: Nov 09, 2005
Posts: 6
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).
 
Consider Paul's rocket mass heater.
 
subject: Linux Installer for a Swing Application
 
Similar Threads
jar file execution in linux.
How to deploy a GUI Swing application?
packaging an application in netbeans that uses javax.comm
packaging an application in netbeans that uses javax.comm
Problem Installer Creator....