In this tutorial we will explain how to Deploy Java 8 with package in the SCCM 2012. The deployment is based on script silently installation and install both version x32 and x64. The package will disable automatic update check. The entire process will be a silent install – your end-user won’t notice a thing! Included the tutorial for deploying java offline exe for version 8 update 91 or above.
If older version is detected, this package will first uninstall the older version of java then proceed with the installation of newer version. The following tasks included:
- Deploy Java 8 x32 and install silently with script
- Deploy Java 8 x64 and install silently with script
- Disable Update Checking / Auto update
- Deploy Java Offline Exe 8 update 91 and above versions.
Note: The script can run with and without SCCM 2012.
Create package on your PC for Deploy Java 8.
Preparation:
Please look the instruction how Download and extract msi for Java 8 on the previous post:
LINK : http://www.get-itsolutions.com/java-silent-install-version-8-and-uninstall-older-version/
Create a folder with name “ Deploy Java 8 .x Package ” and save the downloaded msi file for x32 and x64.
Find java product code.
Find the product code of java older version. For this go to regedit in path:
“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” and find your java version.
- For my case of Java 8 Update 31 is “26A24AE4-039D-4CA4-87B4-2F83218031F0” for 32 bit.
- For 64 bit only change this number 32 to 64: “2F83218031F0” to “2F86418031F0”.
Create .cmd script for deploy java 8.
Note! If the msi installer doesnt work please use the exe installer solution.
Open notepad and write the following command line and save on deploy java 8.x folder:
@echo off
@rem DESCRIPTION: Deploy Java 8 x32 and x64
@echo off
@Rem === Variables_declaration-START =========
Set AppliName=Oracle Java Runtime JRE 8
Set Unin1=Uninstall old java 32Bit
Set Unin2=Uninstall old java 64Bit
Set PackageName=Oracle_Java-RunTime-8
Set LogfilepathCmd=C:\Log_Test\%PackageName%_Upd_Script.txt
@Rem === Variables_declaration-END ========
cls
if not exist "C:\Log_Test\" md "C:\Log_Test\"
@echo ----------------- >>%LogfilepathCmd%
@echo %AppliName% install script >>%LogfilepathCmd%
@echo This logs doesn't include the %AppliName% install logs. Please refer to the file for more information. >>%LogfilepathCmd%
@echo. >>%LogfilepathCmd%
FOR /F %%I IN ('DATE /T') DO FOR /F %%J IN ('Time /T') DO echo %%I %%J >>%LogfilepathCmd%
@echo. >>%LogfilepathCmd%
Rem ===============================
Rem ========= Uninstallation ===========
Rem ===============================
@echo ----------------------------- >>%LogfilepathCmd%
@echo Uninstallation of %Unin1% >>%LogfilepathCmd%
REM Uninstall old Java 32 bit
Start /wait msiexec.exe /x {Product code of your older java 32 bit} /qn /norestart /l* "C:\Log_Test\%PackageName%_Unin_old_x32.txt"
set errorcode=%errorlevel%
If "%errorCode%"=="3010" (Set errorcode=0
@echo errorCode=3010, A restart is required to complet the install >>%LogfilepathCmd%
)
If "%errorCode%"=="1641" (Set errorcode=0
@echo errorCode=1641, The installer has initiated a restart >>%LogfilepathCmd%
)
@echo Return Code of %Unin1% Uninstallation = %errorcode% >>%LogfilepathCmd%
@echo. >>%LogfilepathCmd%
@echo Uninstallation of %Unin2% >>%LogfilepathCmd%
REM Uninstall old java x64
Start /wait msiexec.exe /x {Product code of your older java 64bit} /qn /norestart /l* "C:\Log_Test\%PackageName%_Unin_old_x64.txt"
set errorcode=%errorlevel%
If "%errorCode%"=="3010" (Set errorcode=0
@echo errorCode=3010, A restart is required to complet the install >>%LogfilepathCmd%
)
If "%errorCode%"=="1641" (Set errorcode=0
@echo errorCode=1641, The installer has initiated a restart >>%LogfilepathCmd%
)
@echo Return Code of %Unin2% Uninstallation = %errorcode% >>%LogfilepathCmd%
@echo. >>%LogfilepathCmd%
Rem ==========================
Rem ========= Installation ===========
Rem ==========================
@echo Installation of %AppliName% >>%LogfilepathCmd%
REM Deploy Java 8 x32
start /wait msiexec /i "%~dp0jre1.8.0_40x32.msi" JU=0 JAVAUPDATE=0 AUTOUPDATECHECK=0 RebootYesNo=No WEB_JAVA=1 /q /l* "C:\Log_Test\%PackageName%_insta_Script_x32.txt"
If "%errorCode%"=="3010" (Set errorcode=0
@echo errorCode=3010, A restart is required to complet the install >>%LogfilepathCmd%
)
If "%errorCode%"=="1641" (Set errorcode=0
@echo errorCode=1641, The installer has initiated a restart >>%LogfilepathCmd%
)
@echo Return Code of %AppliName% installation = %errorcode% >>%LogfilepathCmd%
@echo. >>%LogfilepathCmd%
REM Deploy Java 8 X64
start /wait msiexec /i "%~dp0jre1.8.0_40x64.msi" JU=0 JAVAUPDATE=0 AUTOUPDATECHECK=0 RebootYesNo=No WEB_JAVA=1 /q /l* "C:\Log_Test\%PackageName%_insta_Script_x64.txt"
If "%errorCode%"=="3010" (Set errorcode=0
@echo errorCode=3010, A restart is required to complet the install >>%LogfilepathCmd%
)
If "%errorCode%"=="1641" (Set errorcode=0
@echo errorCode=1641, The installer has initiated a restart >>%LogfilepathCmd%
)
@echo Return Code of %AppliName% installation = %errorcode% >>%LogfilepathCmd%
@echo. >>%LogfilepathCmd%
del /S /F /Q "C:\Program Files (x86)\Common Files\Java" >> %LogfilepathCmd%
Rem ===========================
Rem ========= End of Script ===========
Rem ==========================
:END
FOR /F %%I IN ('DATE /T') DO FOR /F %%J IN ('Time /T') DO echo %%I %%J >>%LogfilepathCmd%
@echo end of script >>%LogfilepathCmd%
@echo Error code script = %errorcode% >>%LogfilepathCmd%
@echo ----------------------- >>%LogfilepathCmd%
@echo. >>%LogfilepathCmd%
@echo. >>%LogfilepathCmd%
@echo. >>%LogfilepathCmd%
exit %errorcode%
More information’s about deploy Java 8:
This part is for disable java auto update
“JU=0 JAVAUPDATE=0 AUTOUPDATECHECK=0”
Change “%~dp0jre1.8.0_40x32.msi” jre1.8.0_40x32.msi with your named java x32 and jre1.8.0_40x64 with your named java x64.
The path
"C:\Log_Test\"
is for logs.
Deploy java offline exe installer.
This is for java version 8 update 91 and above. The java was changed procedures for msi files.
Download java offline installer and save to the folder.
Change the above script with the following command line :
REM Uninstall Java 8 Update 50
start /wait msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F83218051F0} /qn /norestart
REM Uninstall Java 8 Update 50 64 bit
start /wait msiexec.exe /x {26A24AE4-039D-4CA4-87B4-2F86418051F0} /qn /norestart
@ECHO OFF
start /wait jre-8u91-windows-i586.exe /s
start /wait jre-8u91-windows-x64.exe /s
@echo Disable Auto Updates
reg delete "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy\jucheck" /v "UpdateSchedule" /f
reg delete "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy\jucheck" /v "UpdateMin" /f
reg add "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy" /v EnableJavaUpdate /t REG_DWORD /d 00000000 /f
reg add "HKLM\SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy" /v EnableAutoUpdateCheck /t REG_DWORD /d 00000000 /f
reg add "HKCU\SOFTWARE\JavaSoft\Java Update\Policy" /v EnableJavaUpdate /t REG_DWORD /d 00000000 /f
Note! The other procedures is the same.
Step 2: Create package for Deploy Java 8 on SCCM 2012.
Note: If you want to install the package without deployment, just right-click on the “install.cmd” and run as administrator. Check logs for the perform of the installation.
To create the package follow the instruction in the previous post :
http://www.get-itsolutions.com/deploy-adobe-flash-player-17-package-with-sccm/
The package folder looks like:
Start deployment and you can monitor on the Monitoring menu under Deployments tabs.
Uninstall other version of java.
If you need to uninstall other version of java just copy another line on notepad (install.cmd). Replace product code with your other java version product code:
REM Uninstall Java X 32bit (replace with your java version)
Start /wait msiexec.exe /x {Product code of your older java} /qn /norestart
In this way you can uninstall all version of java in your computer.
If you have any question about deploy java 8, do feel free to ask in the comment section.
—————————————————————————————————————