How to Convert a JRE Installer Executable into a Silent Installer Executable

 

First start with the Sun-delivered Java Runtime Environment executable installer file.  In this case we are using j2re-1_3_1_02-win.exe as shown below.

First you have to take a snapshot (very fast) of what files the JRE is unpacking.  You execute the JRE executable installer file and then quickly take a <Shift>+<Print Screen> so that you know what file name for which you need to search.

 

 

Now that you have a lead that one of the files being unpacked is “data1.cab” do a search on your hardrive(s) for “data1.cab”.  Note that you will probably get more than 1 hit.  By the way, the “Unpacking Java 2 Runtime Environment…” dialog box above could have some other file shown as “Unpacking …”; it just depends on when you happen to hit <Shift>+<Print Screeen>.  For example, here’s another example of what you might get with this executable.

 

 

So, if you find that the first file name is too general and gives too many hits, then try again to “fish” for a file name and see if you can get one that is more unique and gives fewer hits in the disk search.

 

Now perform the search on the filename you found in the preceding step.  If you search on data1.cab, or on the name of any other file that was revealed by the “Unpacking Java 2 Runtime Environment…” dialog box you get a long list of files as shown below.

 

 

So, try searching on the other file name, “DATA.TAG” and you just get a relatively short list of files as shown below.

Now in this case, on my workstation, it turned out that the installer was writing temporary unpack files for the install to C:\Documents and Settings\pcsupport\Local Settings\Temp\pft*.    How did I know that ?  I didn’t, I had to check the different locations of DATA.TAG to figure that out.   By the way, while you are checking for the location of your files, the install of the JRE is halted at the following step as shown below.

 

 

If you were to click “No” on the dialog above, the files in the TEMP area that we are searching for would vanish, so don’t click on “No.”  Don’t click on anything, just leave the license agreement unanswered while you locate the correct TEMP directory where the install has unpacked and staged it’s files.

 

If you didn’t know in advance, you’d have to check out all the locations to find where the files were unpacked to TEMP.  It just so happens that I’m doing this work at about 1:07 p.m. so we know that the file there with that approximate date and time is the correct one as shown in the partial list belown.

 

 

 

So the correct directory is:  C:\Documents and Settings\pcsupport\Local Settings\Temp\pft4E~tmp\disk1  and that is where we find all of the partially unpacked files and file archives that we need to make our own new  JRE installer for the bundled .exe we are going to repackage.  In this case, here it what you find in the directory.

 

So now what you have to do is copy all these files into a permanent directory somewhere.  This is because when you close the installer, these files and the directory holding them would vanish.

 

 

Now you can cancel the install of the original JRE executable installer, because from this point on, you are going to repackage the files you just moved into a new executable JRE installer file that will run in “silent” mode.

 

 

Click on “Exit Setup” to end the installer session. 

 

Next go to the “Start” button and select the “Run” command:

 

 

and then run IExpress which is installed with Internet Explorer, and is found on most recent versions of windows.

 

 

That command brings up IExpress, which is the tool that you will use to repackage the JRE installer files.

 

 

Now just complete the series of screens in IExpress as follows:

 

 

Fill in the name of the package to be created (and by the way, this can be anything, it doesn’t matter what you call the Package).

 

 

Depending on how “silent” you want your install to be, choose the following.  In this case, we wanted the install to be totally silent, so we chose our settings accordingly to accomplish that purpose as shown below.

 

 

 

Next, select (highlight) all the files to be included in the package in the permanent directory that you moved the files from the TEMP install directory into in an earlier step and then click on “Add” to add them to the package.  Don’t include any subdirectories.  IExpress does not support subdirectories.  IExpress can only handle one directory full of files.

 

 

 

Next you type in the install command that the packaged installer will use to install the package.  We want a completely silent install so we have chosen our switches on the install as show below.  Further information on these switches is available at the following web links.  The first link is the source for the information on what the various installer switches do and mean.   Credit and thanks is expressed to Patrick J. Lopresti for his outstanding work putting this page together without which the work accomplished here could not have been done. 

 

http://unattended.sourceforge.net/installers.html

 

and also the same document is reproduced at:

 

http://www.netsrc.us/Case%20Studies/exe_installers.htm

 

 

We are using the –s, -a and –sms switches. You can check the reference above for what they mean, but here is the relevant information from that link reproduced right here which should clarify for you what the different installshield switches mean.

InstallShield

InstallShield is one of the oldest and most widely used application packaging systems.

Installers created by InstallShield recognize the /r, /s, /sms, /f1, and /f2 switches. The installer itself is invariably named setup.exe.

To perform a silent installation, you need an InstallShield "answer file", customarily named setup.iss. Some applications ship with such a file, but if yours does not, you can use the graphical installer itself to create one.

Here is how it works. Run the installer with the /r ("record") switch. Proceed through the dialogs and complete the installation. This will create a setup.iss file and place it in the C:\WINDOWS directory (yes, really). This file will include all of your responses to the InstallShield dialogs, allowing you to perform unattended installations as if you were giving the same answers again. Simply copy setup.iss to the same directory as the installer executable.

Once you have a setup.iss file, run the installer with the /s ("silent") option. This will perform an unattended installation.

Unfortunately, the installer will fork a separate process and exit, meaning it will return immediately even if you run it under start /wait. This makes it useless for scripting purposes. Luckily, there is another switch, /sms, which will cause the installer to pause until the installation completes.

Hence, for an InstallShield application, you want to provide both the /s and the /sms switches.

The /f1filename switch allows you to specify a fully-qualified alternate name for the setup.iss file. Note that there must be no space between the /f1 switch and the file name. This switch works both with /r to create the file and with /s to read it.

The /f2filename switch specifies a log file. Once again, there must be no space between the switch and the file name.

WARNING: Be careful what characters you use in these file names, because InstallShield silently strips certain non-alphanumerics (like hyphens).

Oh, one more thing. The /r and /s switches only work if the release engineer is competent. Many packages have "custom dialogs" which are not supported by setup.iss, which means the dialogs will always appear no matter what you do. For such packages, I suggest asking the vendor to fix their installer. If that does not work, I suggest doing what you can to deprive them of business.

Now continue choosing options as shown below.  Again, here we want a totally silent install.  If you want other options here, you can select them.

This next step you choose the name of your package.  Some things to remember here.  In our case, we are repackaging a JRE executable installer that is automatically called by the web application browser that requires in on client machines that do not have JRE previously installed.  Since the name of this particular executable installer is embedded in the binary configuration files of the application, we need to give it the exact same name as the original JRE executable installer, or else the application won’t be able to find the file and will fail.

Also, we chose the two options listed on this page.  When you choose the second option, you’ll get a dialog box (shown below) so just answer “Yes” to that as well.

Now decide if you want a reboot or not after the install is complete.  For JRE, we don’t need a reboot, so we chose “No Reboot”.

In the original document that showed me how to do this, the authors at the link

http://greenmachine.msfnhosting.com/IEXPRESS/iexjava.htm

chose not to save the “SED” file, so that is what we chose too.  By the way, the link above was the main source which showed how to do this, and I express my gratitude to the authors for providing this on a web page.

Now you are ready to create the package!  How exciting is that ?

While it is creating your new executable Installer file, the following type of DOS command window will show the progress of the creation:

Now you are nearly done.

Just click on “Finish”.  Now you have an executable installer file that your web application can pull down and use to silently install the JRE on client workstations without any prompts.  However, a couple of things to note.

1.      The “certificate” of authenticity from Sun is lost when you repackage like this so your package is treated as an “unsigned” download.  That is because it lacks an Authenticode.  There’s nothing wrong with that, but such executables are sometimes blocked if coming in from the internet.

2.      The installer will be executing ActiveX controls, and your user might get a pop-up dialog on that too.

 

Here is how you deal with those two issues.  You have to make sure that your client machines have their Internet Options set as follows:

ActiveX Controls and Plugins

 

Download Signed ActiveX Controls

Enable

Download Unsigned ActiveX Controls

Enable

Initialize and Script ActiveX controls not marked as safe

Disable

Run ActiveX Controls and Plugins

Enable

Script ActiveX controls marked safe

Prompt

An alternate way to deal with the “Authenticode” issue in step 1 would be to create your own certificate of authenticity and create the installer with that certificate.  Of course you can’t use a “Sun” certificate, because you have repackaged it yourself.  So what you do is create your own certificate.  Perhaps your company has a certificate you can use, or if you have your own consulting company, you can create one to use. 

You can contact a company such as www.ascertia.com to get more information on certificates and how to get one.

Well, you are pretty much done now.  To recap, here are references to the weblinks which made my solution possible.  Before I had read these links, I had no clue how to do this, so I’m very grateful to the people who took the time to post their solutions.

http://greenmachine.msfnhosting.com/IEXPRESS/iexjava.htm

http://unattended.sourceforge.net/installers.html

Here are some additional links.  I didn’t find them very helpful, but you might, so here they are.

http://java.sun.com/products/plugin/1.3/docs/silent.html