Skip to content

Unattended Install: Sun Java Runtime Environment 1.5 Update 8

UPDATE: I’ve added a script for installing the Sun Java Runtime Environment 1.6 Update 1 that I recommend using instead of this script.

This script uses the Java Runtime Environment (JRE) 5.0 Update 8 or below, downloadable from the Sun web site - when downloading, be sure to choose the Offline installation. Also included in this script is fooling Citrix Presentation Server and the IBM BladeCentre/RSA management tool into using the latest version of Java. You could use the same trick for other software that requires a specific version of Java, but it’s not guaranteed to work.

@ECHO OFF
ECHO Sun J2SE Runtime Environment 5.0 Update 8..
START /WAIT jre-1_5_0_08-windows-i586-p.exe /S /V"ALLUSERS=TRUE REBOOT=REALLYSUPPRESS ADDLOCAL=jrecore IEXPLORER=1 JAVAUPDATE=0 /QB-" /QB

FOR /D %%d IN ("%ProgramFiles%\Java\*") DO SET JAVAVERSION=%%d
REG ADD "HKLM\SOFTWARE\JavaSoft\Java Plug-in\%JAVAVERSION%" /v HideSystemTrayIcon /t REG_DWORD /d 0×00000001 /f
REG DELETE HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v SunJavaUpdateSched /f
IF EXIST "%ALLUSERSPROFILE%\Desktop\Java Web Start.LNK" DEL "%ALLUSERSPROFILE%\Desktop\Java Web Start.LNK"
IF EXIST "%ALLUSERSPROFILE%\Start Menu\Programs\Java Web Start\Java Web Start.LNK" RD /Q /S "%ALLUSERSPROFILE%\Start Menu\Programs\Java Web Start"

REM Configure Java for known applicatons..
ECHO Configuring environment for CPS..
REM Find the lastest version of the install JVM from the default path
FOR /D %%d IN ("%ProgramFiles%\Java\*") DO SET JAVAVERSION=%%d
REG ADD "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.4″ /v JavaHome /d "%JAVAVERSION%" /t REG_SZ /f
REG ADD "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.4″ /v MicroVersion /d "2″ /f
REG ADD "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.4″ /v RuntimeLib /d "%JAVAVERSION%\bin\client\jvm.dll" /t REG_SZ /f
REG ADD "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.4.2_06″ /v JavaHome /d "%JAVAVERSION%" /t REG_SZ /f
REG ADD "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.4.2_06″ /v MicroVersion /d "2″ /t REG_SZ /f
REG ADD "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.4.2_06″ /v RuntimeLib /d "%JAVAVERSION%\bin\client\jvm.dll" /t REG_SZ /f

ECHO Configuring environment for IBM BladeCentre/RSA management..
REM Find the lastest version of the install JVM from the default path
FOR /D %%d IN ("%ProgramFiles%\Java\*") DO SET JAVAVERSION=%%d
REG ADD "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.4.2_10″ /v JavaHome /d "%JAVAVERSION%" /t REG_SZ /f
REG ADD "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.4.2_10″ /v MicroVersion /d "2″ /t REG_SZ /f
REG ADD "HKLM\SOFTWARE\JavaSoft\Java Runtime Environment\1.4.2_10″ /v RuntimeLib /d "%JAVAVERSION%\bin\client\jvm.dll" /t REG_SZ /f