Java Runtime Environment Dynamic Installer: Difference between revisions
No edit summary |
|||
Line 19: | Line 19: | ||
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 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). | 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). [It doesn't work now - today the 'current' JRE is Version 6 Update 27, while the link gets Version 6 Update 15. Looks like Oracle isn't updating the Sun auto link.] Getting the Java Runtime to install in a quasi-silent operating mode took some doing. See the [http://java.sun.com/javase/6/docs/technotes/guides/deployment/deployment-guide/silent.html#creating 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== | ==Dependencies== |
Revision as of 14:04, 1 September 2011
Author: trumpetinc (talk, contrib) |
Links
Download: JREDyna.zip (4 KB) original version, based on Inetload (deprecated) plugin.
Download: JREDyna_Inetc.nsh (6 KB) version based on Inetc
Forum: [1]
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:
- Java Launcher with automatic JRE installation
- A slightly better Java Launcher
- New installer with JRE check (includes fixes from 'Simple installer with JRE check' and missing_jre.ini)
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). [It doesn't work now - today the 'current' JRE is Version 6 Update 27, while the link gets Version 6 Update 15. Looks like Oracle isn't updating the Sun auto link.] 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
The original library is dependent on the InetLoad plug-in plugin (deprecated).
The JREDyna_Inetc.nsh‎ not found version depends on the Inetc plug-in plugin.
Usage
Include and Defines
Include the header and define two constants in your .nsi file as follows (note that the !define must come before the !include):
!define JRE_VERSION "1.6" !define JRE_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=33787" !include "JREDyna.nsh"
JRE_VERSION is the lowest required version, not the version of the JRE to download.
If you are to use the JREDyna_Inetc.nsh version of this include file, use instead:
!define JRE_VERSION "1.6" !define JRE_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=33787" !include "JREDyna_Inetc.nsh"
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