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 is an update to the Sun J2SE 1.5.0_08 script. As of this version the /s and /v parameters appear to be case sensitive. I’ve also added a few more registry entries that are edited after installation as well. This script uses the Java Runtime Environment (JRE) 5.0 Update 10, downloadable from the Sun web site - when downloading, be sure to choose the Offline installation. For complete documentation on installing the Sun JRE silently see the Silent Installation documentation on the Sun web site.
@ECHO OFF
ECHO Sun J2SE Runtime Environment 5.0 Update 10..
START /WAIT jre-1_5_0_10-windows-i586-p-s.exe /s /v"ALLUSERS=TRUE REBOOT=REALLYSUPPRESS ADDLOCAL=jrecore IEXPLORER=1 MOZILLA=1 JAVAUPDATE=0 /QB-" /QB
PUSHD "%ProgramFiles%\Java" & FOR /D %d IN (*) DO SET JAVAVERSION=%d & POPD
REG ADD "HKLM\SOFTWARE\JavaSoft\Java Plug-in\%JAVAVERSION%" /v HideSystemTrayIcon /t REG_DWORD /d 0x00000001 /f
REG ADD "HKLM\SOFTWARE\JavaSoft\Java Update\Policy" /v EnableJavaUpdate /t REG_DWORD /d 0 /f
REG ADD "HKLM\SOFTWARE\JavaSoft\Java Update\Policy" /v EnableAutoUpdateCheck /t REG_DWORD /d 0 /f
REG ADD "HKLM\SOFTWARE\JavaSoft\Java Update\Policy" /v NotifyDownload /t REG_DWORD /d 0 /f
REG ADD "HKLM\SOFTWARE\JavaSoft\Java Update\Policy" /v NotifyInstall /t REG_DWORD /d 0 /f
REG DELETE "HKLM\SOFTWARE\JavaSoft\Java Update\Policy" /v PromptAutoUpdateCheck /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"
A number of applications are specific to a particular version on the JRE. Adding a few registry entries can be used to fool the application into thinking that the specific Java version it requires is installed Here’s a couple of examples - 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.
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







