Deploying Java 7 JRE – Deep Dive! (Part 2)

Welcome to Part 2 of my series of Deploying Java 7 JRE – Deep Dive!

Hopefully my first article, Deploying Java 7 JRE – Deep Dive! (Part 1) has helped you understand the history behind what Java have been doing over the past year and how all these changes will affect you. This part will cover the steps to successfully overcome the deployment of Java in an enterprise. So lets get into it!

Packaging Java 7 U 45 to deploy

The below steps are geared towards deploying the 32 bit (x86) version of Java. This version of java works on both Windows 7 32 bit and Windows 7 64 bit (and i’m sure it would work with Windows 8 and possibly XP too but have not tested).

The reason I only deploy the 32bit version to all my clients is because most of our applications are run through the web browser (Internet Explorer), of which we use 32 bit version due to compatibility issues with almost every business application available. Please have a clear understanding of what version you actually require as I notice a lot of people get confused. If in doubt 32bit version works almost always.

Download Package

Download the latest version of Java from Oracle website. The link to get it from is: http://www.oracle.com/technetwork/java/javase/downloads/index.html.

Click on the JRE Download link. This link will take you to the most current version available, currently Java 7 Update 45. The link currently points to http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html.

Here you download the version titled Windows x86 Offline with filename jre-7u45-windows-i586.exe.

Prepare Package

Using EXE installer

You can use the EXE boot strap installer directly without modifying it. Ultimately it will still run an MSI in the background but it also does install other components unless you specify specifically. I prefer the other solution but both work.

Using MSI installer

Double click on the EXE file you downloaded earlier and leave the installation window open. It should look like this:

Now while that window is still open open Windows Explorer and go to the below location and you will see the CAB and MSI files that are needed to deploy via GPO.

C:\Users\%username%\AppData\LocalLow\Sun\Java\

Copy these files to your distribution location (or your staging area).

I no longer create MST files as I have little need for this. We just use arguments when executing. If you are deploying via Group Policy you may want to create an MST file to customise specific configuration – This article provides the steps on doing this for an old version of Java, however it should still be accurate with Version 7.

Explaining the script

Below is the script we are using to deploy the latest update to new and existing computers. Our computers consist of Windows 7 32bit and Windows 7 64bit.

The script does the following in our environment. I have added comments below (and in the script) as to where you can easily deviate/modify to suit your situation:

    • Stopping Java services is imperative to not requite a reboot of the machine before installing the latest version. For logged on users, we execute this script with a special program courtesy of CJWDEV that allows us to check if processes are running, and if so prompts the user to close them so an update can occur. If you do not want to warn users, you can simply run a Kill command for the processes that use Java.
      The processes that I am aware of are:
      java.exe, javaw.exe, javaws.exe, javacpl.exe, iexplore.exe, firefox.exe, chrome.exe
      If you are only installing when a user is logged off, you can be pretty confident that none of these will be running.
    • Uninstall and clean-up all previous versions of Java 7. The method I use is to run repeated MSIEXEC uninstall commands for all specific GUIDS of Java version 7.
      I have only included 32Bit versions as i know my environment does not have 64Bit versions.
      I have not included version 6 as we don’t have any clients with Java 6 installed. This is optional but recommended.
    • We install Java using MSI and have no specific parameters to pass. I use verbose logging in the event a client has an issue deploying the app, I can use to troubleshoot it. I could have removed the Start Menu items through an MST file but suppose this will be more practical for future upgrades.
    • We create two config files to prevent the new auto-updating solution from kicking in. Also additional configuration to reduce security settings. Below is a view of the output that the script produces.
      %WinDir%\Sun\Java\Deployment\deployment.properties

      %WinDir%\Sun\Java\Deployment\deployment.config

The Script

Below is the script. There are many comments in there to help explain what each step is for, and where you can add your additional steps should you choose to.

How to run the Script

We use this script in our SCCM 2012 environment (application – not a package) both as a mandatory deployment to machines and an available application to users. Our configuration checks the client if the application is installed (Using MSI GUID as reference) and if its not, it runs the script.

Running this script as a GPO start-up script is possible, so long as you include a check at the beginning to see if the software is already installed. A smart way to do this is to run java.exe -version, parse the results and if they result to being the current version, then skip install. A crude way to do this is to assume that every installation is successful, and write a file to a location on the system drive called Java7U45_installed.txt at the end of the script. Then simply do a check at the start of the script to see if this file exists, if not then proceed, otherwise go to end.

Running this script using Kace/Alteris/PDQ Deploy should also work without problems so long as the client can execute the script, and have access to all the files within the same location as the script. If you wanted to use the Process Prompt tool for checking that the process has been closed, you will need to make sure your tool can run the deployment interactively with the logged on user.

Stopping Processes

The method that I use to make sure processes are stopped is with a wonderful piece of software written by CJWDEV.
It allows me to simply enter the process names that i want to monitor, a description and a timeout for how long to ask a user (there are lots more settings to play with). With all this information I can push an interactive mandatory deployment using SCCM 2012 (System Center Configuration Manager 2012) and be sure that Java will successfully deploy.
Keep an eye out – an article on this will be coming shortly.

Conclusion

Hopefully this has allowed you to configure and deploy Java 7 Update 45 to your end users successfully. I cant stress enough how much you need to test this solution before rolling it out. Testing is very important.

As with always, feel free to post up your comments.

References:

Below are references that I passed along when writing this article series. To better understand this topic i suggest you start by researching the below links.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

QR Code Business Card