1

This is still awhile down the road for me but for my Project Implementation class we have to create a program and then distribute it. I have written an application in Java and from the specification I have made in the previous class (Project Design) my application will need to be platform-independent.

For mac and linux the user can just run the jar file from the terminal, but for windows I would like to have the Application installed to the path user chooses (default: C:\Program Files(x86)\NameOfApplication), Create a desktop shortcut (if the user wishes to have one), install under the start menu (if the user wants it to) and then also show up in the add\remove programs list.

Is there any easy way to do this?

Is it any harder if I did decided to create an installer for mac and linux?

Thanks in Advance.

Erick Robertson
  • 32,125
  • 13
  • 69
  • 98
jbeverid
  • 291
  • 7
  • 23
  • 4
    This has been discussed many many many times before... Please do some search before asking – Adel Boutros Feb 23 '12 at 14:01
  • 1
    ...so many... duplicates... can't compute... – epoch Feb 23 '12 at 14:19
  • possible duplicate of [How to make installer of java desktop application for multi-platform?](http://stackoverflow.com/questions/979572/how-to-make-installer-of-java-desktop-application-for-multi-platform) – Caleb Feb 23 '12 at 23:06

6 Answers6

2

You can create an installer with NSIS, even for a Java application.

You might also consider distributing your application via Java Web Start.

Emmanuel Bourg
  • 9,601
  • 3
  • 48
  • 76
  • 1
    Java Web Start seems to be the expected route, for distributing Java applications. –  Feb 23 '12 at 14:04
1

There are opensource installer generators for java. I have never used one before. Here is a good resource of links

I recommend using Java Web Start.

It has several advantages.

  1. Available for all major desktop platforms
  2. Single distribution for all JWS-enabled platforms
  3. Code-signing and sandboxing
  4. Versioning and incremental updates
  5. Automatic installation of JREs and optional packages

It has one major disadvantage.

  1. Internet connectivity is required if JWS, JRE, and/or an Optional Package is not present on the system

Have a look here and here

Community
  • 1
  • 1
John Eipe
  • 10,922
  • 24
  • 72
  • 114
0

If your target OS is windows I highly recommend Advanced Installer. It's very very easy to use and will let you create your own native microsoft installer (.msi) with specific target Java VM and a bunch of useful windows features, even in the free version. Note you can also include a private jre into the package.

http://www.advancedinstaller.com/top-freeware-features.html

If you want a "package one deploy everywhere" solution then IzPack is the way to go, platform independant, free and open source.

http://izpack.org/

Depending on the complexity of your project Java Web Start could be a very good option, it's very simple configure and maintain but it relies on the browser's java plugin and believe me... most users DON'T like being warned about certificates and risks everytime they launch an application.

Roger
  • 1
  • 1
0

Install4j does what you want, although you have to pay for it. Personally, I am not aware of any free alternatives. You can make installers for Linux and Mac OS as well.

jlemos
  • 526
  • 4
  • 13
0

you can use Exe4J, see http://www.ej-technologies.com/products/exe4j/overview.html

Sam
  • 6,770
  • 7
  • 50
  • 91
0

You can do most of that using standard JNLP:

http://docs.oracle.com/javase/1.4.2/docs/guide/jws/developersguide/syntax.html

You make a JNLP file that takes the executable JAR from some local (or remote) location and creates a Desktop icon for it (of your chosing). Only difference is that the actual JAR will be placed in the JDK's jar cache directory (not in a directory of your choice - I don't think the user would care much).

The huge advantage with this is that if you make a JNLP that installs the jar from a remote location, you can remotely upload a new version of the jar to that location, and when the user next accesses the jar locally, your latest version will be downloaded and placed into local cache.

Also I recommend you use a smart "fat JAR" builder, which packages all dependency jars inside the executable jar. Eclipse IDE has a way to export a project in this format (and also adds the necessary class-loader so that all works ok from on fat jar).

Shivan Dragon
  • 15,004
  • 9
  • 62
  • 103