Java Runtime Environment Dynamic Installer: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
{{PageAuthor|trumpetinc}}
{{PageAuthor|trumpetinc}}
==Links==
==Links==
<attach>JREDyna.zip</attach>
[[File:JREDyna.zip]]
==Description==
==Description==
A header that makes it easy to add Java Runtime installation to your installer. Includes version detection, optional custom page to tell user that JRE installation is going to occur, automatic download of the latest JRE and installation.
A header that makes it easy to add Java Runtime installation to your installer. Includes version detection, optional custom page to tell user that JRE installation is going to occur, automatic download of the latest JRE and installation.
Line 46: Line 46:


==Future Improvements==
==Future Improvements==
1. The text strings used in this page should be configurable, and should be i18n aware
*The text strings used in this page should be configurable, and should be i18n aware
2. Add option to control whether the JRE install is silent (no dialogs or progress bars displayed). Personally, I don't like having it be completely hidden as this introduces large delays with no visible user feedback - but other users may feel differently.  Having the user click a couple of buttons in Sun's installer is acceptable, I think (the same thing occurs with apps that include download of .NET, for example).
*Add option to control whether the JRE install is silent (no dialogs or progress bars displayed). Personally, I don't like having it be completely hidden as this introduces large delays with no visible user feedback - but other users may feel differently.  Having the user click a couple of buttons in Sun's installer is acceptable, I think (the same thing occurs with apps that include download of .NET, for example).
3. Maybe make JRE_URL define optional
*Maybe make JRE_URL define optional

Revision as of 23:10, 21 August 2009

Author: trumpetinc (talk, contrib)


Links

File:JREDyna.zip

Description

A header that makes it easy to add Java Runtime installation to your installer. Includes version detection, optional custom page to tell user that JRE installation is going to occur, automatic download of the latest JRE and installation.

Discussion

I've always felt that it should be *easy* to install the Java Runtime while installing our applications, and without making our installer contain the 10MB JRE installer. Sun has focused their energy on making installation easy from inside a web page, but for those of us still installing applications on workstations, no decent option is available.

There are a number of projects in the wiki that address some of the problem, but none in a way that was easy to just drop into an existing installer. Here are some examples:

The important thing about this library is that it makes it easy to drop into any installer. The end result is an installation experience that is similar to the .NET download that is part of many applications dependent on that framework.

The download URL for the Java Runtime that is shown in the examples will get the latest version of the JRE (and should continue to work, even as Sun releases new builds). Getting the Java Runtime to install in a quasi-silent operating mode took some doing. See the Sun documentation on silent mode operation as a starting place, but be aware that Sun's installer is a small executable that downloads a larger MSI file, then calls msiexec with a bunch of command line arguments.

Dependencies

This library is dependent on the Inetload plug-in plugin.

Usage

Include and Defines

Include the header and define two constants in your .nsi file as follows:

 !include "JREDyna.nsh"
 !define JRE_VERSION "1.6"
 !define JRE_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=33787"

Add page notifying user that JRE installation is required (Optional)

When declaring your pages, use the following macro to insert the JRE notification page:

 !insertmacro CUSTOM_PAGE_JREINFO

Detect, download and install JRE - if necessary

In one of your installation sections, make the following call:

 call DownloadAndInstallJREIfNecessary

Future Improvements

  • The text strings used in this page should be configurable, and should be i18n aware
  • Add option to control whether the JRE install is silent (no dialogs or progress bars displayed). Personally, I don't like having it be completely hidden as this introduces large delays with no visible user feedback - but other users may feel differently. Having the user click a couple of buttons in Sun's installer is acceptable, I think (the same thing occurs with apps that include download of .NET, for example).
  • Maybe make JRE_URL define optional