Unattended Install: Sun Java Runtime Environment 1.6
For a more up-to-date version of this script, please see this page: Unattended Install: Unattended Install: Sun Java Runtime Environment 1.6 Update 3
The Sun JRE 1.6 is required for full Vista compatibility (although the Control Panel applet still does not prompt for elevation). This script uses the Java Runtime Environment (JRE) 6 Windows Offline package downloadable from the Sun Java SE Downloads page. For full details on a silent installation see the Silent Installation documentation on the Sun web site.
@ECHO OFF
ECHO Sun J2SE Runtime Environment 6..
START /WAIT jre-6-windows-i586.exe /s ADDLOCAL=jrecore IEXPLORER=1 MOZILLA=1 JAVAUPDATE=0 REBOOT=Suppress /L %SYSTEMROOT%\TEMP\JRE6setup.log
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
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.
<p class="code">REM Configure Java for known applicatons..
ECHO Configuring environment for Presentation Server 4.0..
REM Find the lastest version of the install JVM from the default path
PUSHD "%ProgramFiles%\Java" & FOR /D %d IN (*) DO SET JAVAVERSION=%d & POPD
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
PUSHD "%ProgramFiles%\Java" & FOR /D %d IN (*) DO SET JAVAVERSION=%d & POPD
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