Menu

Creating_WSUS_updates_for_Java

snarfle Bryan Dam

Warning: You don't want to have multiple versions approved at the same time for the same machines. When creating the newer package be sure to make it supersede the older one.

  • Download the java installation files.
  • Using the steps here, extract the files from the executable.
  • In LUP, select Tools/Create Update.
  • Click the Browse for Update File and point to the MSI file.
  • Click the Add File button and select the data1.cab file.
  • Click Next.
  • Change the Package Title and Description to reflect the version being installed (ie “Java 6 update 21”).
  • The two fields that are required (Vendor and Product) should be set to "Sun Microsystems, Inc." and "Java." All of the other fields are optional.
  • Click Next until the update gets added.

Customizing

There is a document here that describes configuration files for java that can be used to disable auto updates (among other things). In order to create these files during installation, see [Creating_Configuration_files_during_installation.] Note that while those docs say the entry in the InstallExecuteSequence table should go just below InstallFinalize, Java doesn't leave any room between their entries. I just use 6500 which puts it at the very end.

Here is a sample script that can serve as a starting point for configuring Java

' This is a sample script showing how to create config files for Java.  It
' is intended to be added to an MST during Java installs.

' Note: It only works on x86 machines.

option explicit

dim objFSO, wshShell, sArchitecture

' This script only works on x86
Set wshShell = CreateObject( "WScript.Shell" )
Set objFSO = CreateObject("Scripting.FileSystemObject")

sArchitecture = wshShell.ExpandEnvironmentStrings("%PROCESSOR_ARCHITECTURE%")

if sArchitecture = "x86" then
   KillJUSchedProcess()     ' Kill the jusched process if it is running
   CreateDeploymentFiles()  ' Create the Java configuration files
   DeleteRegistryKeys()     ' Delete registry keys to prevent autoupdates
end if

' =============================================================
sub KillJUSchedProcess

' You must kill the jusched.exe process before updating anything.  Otherwise 
' it just writes everything back when it shuts down.

dim objWMIService, colProcess, objProcess

Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

Set colProcess = objWMIService.ExecQuery ("Select __relpath from Win32_Process Where Name = 'jusched.exe'")

For Each objProcess in colProcess
   objProcess.Terminate()
Next

end sub

' =============================================================
sub CreateDeploymentFiles

Const ForWriting = 2
dim objTextFile, sFileName, sMangled, sWinDir, sPropFolder

sWinDir = wshShell.ExpandEnvironmentStrings("%windir%")
sPropFolder = "\Sun\Java\Deployment"
sFileName = sWinDir & sPropFolder & "\deployment.properties"

' Java REALLY mangles directory names.  Not only must each \ be prefixed with a \,
' but each : must also be prefixed with a \.

' So:

'    file:\c:\Windows\Sun\Java\Deployment\deployment.properties

' becomes:

'    file:\\c\:\\Windows\\Sun\\Java\\Deployment\\deployment.properties

sMangled = Replace(sFileName, "\", "\\")
sMangled = Replace(sMangled, ":", "\:")

' Make sure the folder exists
CreateFolder(sWinDir & sPropFolder)

' Write deployment.properties file
Set objTextFile = objFSO.OpenTextFile (sFileName, ForWriting, True)

' Write the configuration settings
objTextFile.WriteLine("deployment.javaws.autodownload=NEVER")
objTextFile.WriteLine("deployment.javaws.autodownload.locked=")

objTextFile.Close

' Write the deployment.config file.  This file describes where the deployment.properties file
' can be found, and whether Java should run without it.
sFileName = sWinDir & sPropFolder & "\deployment.config"

' Overwrite any existing file
Set objTextFile = objFSO.OpenTextFile (sFileName, ForWriting, True)

' Write the configuration settings
objTextFile.WriteLine("deployment.system.config=file:\\" & sMangled)
objTextFile.WriteLine("deployment.system.config.mandatory=true")

objTextFile.Close

end sub

' =============================================================
sub DeleteRegistryKeys

on error resume next

' Delete this specific registry value
WshShell.RegDelete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\SunJavaUpdateSched"

' Delete this entire registry key (and all subkeys, values, etc).  Doing this removes the whole
' Update tab from the Java control panel
WshShell.RegDelete "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Update\Policy\"

end sub

' =============================================================
'Recursive folder create, will create directories and Sub
Sub CreateFolder( strPath )
   On Error Resume Next
   If strPath

Related

Wiki: Creating_Configuration_files_during_installation.
Wiki: Creating_WSUS_updates_for_Java_(v6_–_21)
Wiki: Main_Page

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.