Pages

2009-10-19

Install a recent JRE as prerequisite in an InstallAware Package

I wanted to deploy a Java application as an InstallAware Package, however I wanted to provide a more recent JRE as 1.6.1 provided with IA9.

These are the steps:

1. Download the most recent JRE and place them somewhere in your project's directory (e.g.: C:\Project\FileBag). My directory contents looked like this:

  • jre-6u16-windows-i586.exe
  • jre-6u16-windows-x64.exe
2. Create a file bag inside IA:

Set Variable FILEBAG to

Define File Bag : C:\Project\FileBag\*.*, get runtime location of files into variable FILEBAG


2. Check if the OS is 32 or 64 bit:

Get System Setting Windows in 64 bit Mode into WIN_64BIT

if Variable WIN_64BIT Equals TRUE
   Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
end


3. Add a check for JRE in the prerequisite check section:

Read Registry Key HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.6\JavaHome into JRE

if Variable JRE Equals
   Set Variable PREREQ to TRUE
   Set Variable PRELIST to $PRELIST$$NEWLINE$Java(TM) SE Runtime Environment 6
end

3. Add JRE installation in prerequisite installation section:
if Variable JRE Equals

   Set Variable PROGRESSTEXT to Java(TM) SE Runtime Environment 6
   Set Variable JRERES to
   Set Variable JREERR to
   Set Variable JRE_INSTALLER to



   if Variable WIN_64BIT Equals TRUE
      Set Variable JRE_INSTALLER to $FILEBAG$\jre-6u16-windows-x64.exe
   else
      Set Variable JRE_INSTALLER to $FILEBAG$\jre-6u16-windows-i586.exe
   end


   Run Program $JRE_INSTALLER$ /s /v"/qnADDLOCAL=ALL UPDATE=1 IEXPLORER=1 NETSCAPE6=1 MOZILLA=1 REBOOT=Suppress JAVAUPDATE=0 WEBSTARTICON=0 EULA=1" (WAIT, get result into variable JRERES)


   if Variable JRERES not Equals 0
       MessageBox: $TITLE$ Setup, Java(TM) SE Runtime Environment 6 installation has failed.$NEWLINE$$NEWLINE$$JREERR$$NEWLINE$$NEWLINE$$TITLE$ Setup cannot continue.
       Terminate Installation
   else
       Read Registry Key HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.6\JavaHome into JRE


   end
end

That's it!

No comments:

Post a Comment