It seems that you have misunderstood my explanation. Note that the custom action i mentioned is an example. You need to modify it to suit your needs.
Here is a custom action which does what you need:
Code: Select all
const HKEY_CURRENT_USER = &H80000001
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
'find newest JRE version
strKeyPath = "SOFTWARE\JavaSoft\Java Runtime Environment\"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
For Each subkey In arrSubKeys
newest_version=subkey
Next
Session.Property("JAVA_NEWEST_VERSION")=newest_version
'find the path
strKeyPath = "SOFTWARE\JavaSoft\Java Runtime Environment\" & newest_version
strValueName = "JavaHome"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
Session.Property("JAVA_HOME_PATH")=strValue
Regards,
Cosmin