Java replacement AdoptOpenJDK

If anyone has developed AdoptOpenJDK J9 fixlet and tasks (to work similar to how Oracle Java fixlets and tasks work) - can you share here? Thank-you!

1 Like

I’m not at work so I can’t take a look at all of the different Oracle Java fixlets, but maybe this will get you started. This was all done in the fixletdebugger so you’ll have to modify it a bit. Also, this is for the latest version available that I could see.

// Action Script
// Delete the file if it already exists, You probably won't need to do this.
delete "c:\windows\temp\OpenJDK12U-jdk_x64_windows_openj9_12.0.2_10_openj9-0.15.1.msi"

// Check if there is a lesser version of AdoptOpenJDK J9 version 12 on the machine, OR no version of AdoptOpenJDK J9 at all. If TRUE, install the current version '12.0.2.10'
if {exists key whose (value "DisplayName" of it as string as lowercase contains "adoptopenjdk" as lowercase AND value "DisplayName" of it as string as lowercase contains "j9" as lowercase AND value "Publisher" of it as string as lowercase contains "adoptopenjdk" as lowercase AND value "DisplayVersion" of it as string as lowercase < "12.0.2.10" as version) of key "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (x64 registries) OR not exists key whose (value "DisplayName" of it as string as lowercase contains "adoptopenjdk" as lowercase AND value "DisplayName" of it as string as lowercase contains "j9" as lowercase AND value "Publisher" of it as string as lowercase contains "adoptopenjdk" as lowercase) of key "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (x64 registries)}

// Prefetch the msi. You'll probably need to download it yourself and precache it.
prefetch OpenJDK12U-jdk_x64_windows_openj9_12.0.2_10_openj9-0.15.1.msi sha1:3c0e25fb36db25a8c9d835c619b7160ece65124d size:182390784 "https://github-production-release-asset-2e65be.s3.amazonaws.com/172940752/cfee4b80-aa35-11e9-9eed-e68d00be34a5?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190815%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190815T044740Z&X-Amz-Expires=300&X-Amz-Signature=5875693813584920cd4134e3f9a42fcdf52d9d1c3cef5086cc5a9d9574381b9e&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment%3B%20filename%3DOpenJDK12U-jdk_x64_windows_openj9_12.0.2_10_openj9-0.15.1.msi&response-content-type=application%2Foctet-stream"

// Remove older versions
delete __appendfile
appendfile {concatenation "%0d%0a" of ("start /w msiexec /x" & name of it & " /qn REBOOT=ReallySuppress") of keys whose (value "DisplayName" of it as string as lowercase contains "adoptopenjdk" AND value "Publisher" of it as string as lowercase contains "adoptopenjdk") of keys "HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall" of (x64 registries)}

delete uninstallOldOpenJDK.bat
copy __appendfile uninstallOldOpenJDK.bat
wait uninstallOldOpenJDK.bat


// Copy to C:\Windows\Temp
copy __download\OpenJDK12U-jdk_x64_windows_openj9_12.0.2_10_openj9-0.15.1.msi "c:\windows\temp\OpenJDK12U-jdk_x64_windows_openj9_12.0.2_10_openj9-0.15.1.msi"

// Install to C:\AdoptOpenJDK_J9"
runhidden msiexec.exe /i "c:\windows\temp\OpenJDK12U-jdk_x64_windows_openj9_12.0.2_10_openj9-0.15.1.msi" INSTALLDIR="C:\AdoptOpenJDK_J9" /qn

endif