You can find the correct product code to pass to msiexec /x by opening in the registry (regedit). Open the key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

Select the Uninstall key and "Find" from the "Edit" menu. Search for "Java." This should show which subkey the Java is located under. One of the keys is "UninstallString." Use this command to uninstall Java. Note however, this will only work on other machines if the exact same version of Java is installed.

Answer from heavyd on Stack Exchange
🌐
Oracle
java.com › en › download › uninstalltool.jsp
Java Uninstall Tool for macOS
If you are still having trouble uninstalling out-of-date versions of Java, you can request further uninstall help.
🌐
Oracle
forums.oracle.com › ords › apexds › post › clean-uninstalltion-of-oracle-java-3708
Clean uninstalltion of Oracle JAVA - Oracle Forums
September 3, 2024 - Dear all, due two changes in ORACLE JAVA licensing we wan't two remove ORACLE JAVA from anumber of Windows Systems. Some are never WIn 10,64bit, most are older 32 Bit Systems using Win7 and XP I ...
Discussions

Remove Java from ALL systems.
I recommend CI/CB. Check if Java is installed. If found execute the uninstall string from the registry. $javaVer = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object {$_.DisplayName -match "^Java \d Update \d{3}.*$" } | Select-Object -Property DisplayName, UninstallString ForEach ($ver in $javaVer) { If ($ver.UninstallString) { $uninst = $ver.UninstallString Start-Process cmd -ArgumentList "/c $uninst /quiet /norestart" -Verb RunAs -Wait } } More on reddit.com
🌐 r/SCCM
47
34
August 28, 2023
Unable to uninstall old version of Java
The uninstallation process that you have performed may have removed the main body of Java's files, i.e. JDK/SDK, JRE. Some community members may try to check for specific file corruption by using some tools. More on learn.microsoft.com
🌐 learn.microsoft.com
3
0
October 24, 2024
Java uninstall tool
Hello all are there any switches for java uninstall tool, We want to uninstall Java JRE and then SDK. Regards More on community.spiceworks.com
🌐 community.spiceworks.com
7
7
September 9, 2020
Java Uninstall
$javaVer = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object {$_.DisplayName -match "java" } | Select-Object -Property DisplayName, UninstallString ForEach ($ver in $javaVer) { If ($ver.UninstallString) { $uninst = $ver.UninstallString Start-Process cmd -ArgumentList "/c $uninst /quiet /norestart" -Verb RunAs -Wait } } More on reddit.com
🌐 r/sysadmin
31
25
February 17, 2020
🌐
Spidertechnet
spidertechnet.richmond.edu › TDClient › 1955 › Portal › KB › ArticleDet
Java Uninstall Tool for Windows computers
This tool will allow Windows computers to uninstall all versions of Java from Windows computers.
🌐
Oracle
java.com › en › download › help › uninstaller_toolfaq.html
Information about the Java uninstaller tool
The tool checks to see if there are Java versions that can be removed. If there are none, you will see a message that there are no versions of Java on your computer, otherwise you will be presented with a list of versions and if you click Uninstall Selected Versions, the process to remove them begins.
🌐
Reddit
reddit.com › r/sccm › remove java from all systems.
r/SCCM on Reddit: Remove Java from ALL systems.
August 28, 2023 -

Hello i have been recently tasked with a plan and execute the removal of java from all systems in our environment. The previous person was attempting to complete this through a series of task Sequences in SCCM but was not very successful. Are there any scripts to complete this task and should it be completed by task sequence?

🌐
Chocolatey
community.chocolatey.org › packages › javauninstalltool
Chocolatey Software | Java Uninstall Tool (Portable) 25.0.0
The Java Uninstall tool helps you improve your computer security by simplifying the process of finding and uninstalling versions of Java.
Find elsewhere
🌐
Microsoft Learn
learn.microsoft.com › en-us › answers › questions › 3957838 › unable-to-uninstall-old-version-of-java
Unable to uninstall old version of Java - Microsoft Q&A
October 24, 2024 - Hello, a few days ago I decided to uninstall java from my computer. I noticed that I had two versions installed, Java 8 Update 311 and Java 8 Update 291. To uninstall 311 I simply clicked on it from the Control Panel and clicked "uninstall".…
🌐
VA
oit.va.gov › services › trm › ToolPage.aspx
Java Uninstall Tool
Adobe Reader and Acrobat Cleaner Tool - Authorized w/ Constraints · Uninstaller - Unauthorized, Conditions Required (POA&M Required)
🌐
YouTube
youtube.com › mukesh otwani
How To Uninstall Java On MAC M2| M1| Or Any Other Version - YouTube
You might need to remove or uninstall java due to any reason then follow below commandsUninstall javarm will remove the specified file or directory.options-r...
Published   September 19, 2023
Views   11K
🌐
Oracle
java.com › remove
How do I uninstall Java on my Windows computer?
Windows Users: Improve the security of your computer by checking for old versions of Java and removing them when you install Java 8 (8u20 and later versions) or by using the Java Uninstall Tool.
🌐
Reddit
reddit.com › r/sysadmin › java uninstall
r/sysadmin on Reddit: Java Uninstall
February 17, 2020 -

Trying to do cleanup, a lot of machine have various old versions of java installed, does anyone have a saving grace, uninstall all old java versions script?

Top answer
1 of 5
23
$javaVer = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object {$_.DisplayName -match "java" } | Select-Object -Property DisplayName, UninstallString ForEach ($ver in $javaVer) { If ($ver.UninstallString) { $uninst = $ver.UninstallString Start-Process cmd -ArgumentList "/c $uninst /quiet /norestart" -Verb RunAs -Wait } }
2 of 5
10
I have this that I used ages ago. As you can see I stopped updating it after 201. However, I believe you can just adjust the SID for later version via the last 6 digits. It does seem to follow a pattern. ::uninstall previously used versions of java :: ::1.4.2.12 MsiExec.exe /x{7148F0A8-6813-11D6-A77B-00B0D0142120} /passive /qb /norestart ::remove 6u29 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83216029FF} /passive /qb ::remove 6u33 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83216033FF} /passive /qb ::remove 6u35 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83216035FF} /passive /qb ::remove 7u25 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83217025FF} /passive /qb ::remove 7u45 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83217045FF} /passive /qb ::remove 7u51 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83217051FF} /passive /qb ::remove 7u55 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83217055FF} /passive /qb ::remove 7u60 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F03217060FF} /passive /qb ::remove 7u65 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F03217065FF} /passive /qb ::remove 7u67 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F03217067FF} /passive /qb ::remove 7u71 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F03217071FF} /passive /qb ::remove 7u76 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F03217076FF} /passive /qb ::remove 8u31 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83218031F0} /passive /qb ::remove 8u40 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83218040F0} /passive /qb ::remove 8u45 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83218045F0} /passive /qb /norestart ::remove 8u51 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83218051F0} /passive /qb /norestart ::remove 8u60 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83218060F0} /passive /qb /norestart ::remove 8u65 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83218065F0} /passive /qb /norestart ::remove 8u71 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83218071F0} /passive /qb /norestart ::remove 8u77 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83218077F0} /passive /qb /norestart ::remove 8u92 MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83218092F0} /passive /qb /norestart ::remove 8u101 MsiExec.exe /X{26a24ae4-039d-4ca4-87b4-2f32180101f0} /passive /qb /norestart ::remove 8u111 msiexec.exe /x{26a24ae4-039d-4ca4-87b4-2f32180111f0} /passive /qb /norestart ::remove 8u121 msiexec.exe /x{26a24ae4-039d-4ca4-87b4-2f32180121f0} /passive /qb /norestart ::remove 8u131 msiexec.exe /x{26a24ae4-039d-4ca4-87b4-2f32180131f0} /passive /qb /norestart ::remove 8u141 msiexec.exe /x{26a24ae4-039d-4ca4-87b4-2f32180141f0} /passive /qb /norestart ::remove 8u151 msiexec.exe /x{26a24ae4-039d-4ca4-87b4-2f32180151f0} /passive /qb /norestart ::remove 8u161 msiexec.exe /x{26a24ae4-039d-4ca4-87b4-2f32180161f0} /passive /qb /norestart ::remove 8u171 msiexec.exe /x{26a24ae4-039d-4ca4-87b4-2f32180171f0} /passive /qb /norestart ::remove 8u181 msiexec.exe /x{26a24ae4-039d-4ca4-87b4-2f32180181f0} /passive /qb /norestart ::remove 8u201 msiexec.exe /x{26a24ae4-039d-4ca4-87b4-2f32180201f0} /passive /qb /norestart
🌐
Oracle
java.com › en › uninstall
Uninstall Index
Keeping out-of-date versions of Java on your system may present a serious security risk. To help you remove out-of-date Java installations, we have created a Java Uninstall Tool.
🌐
Reddit
reddit.com › r/intune › mass uninstall of all java versions
r/Intune on Reddit: Mass Uninstall of all Java Versions
May 8, 2024 -

Apparently, Oracle is trying to bill us for any version installed by end users

I am not trying to reinvent the wheel, so I am hoping someone else here has dealt with this and can help me to create an intune app or remediation to remove all versions of Java from a group of devices.

I have tried using the software deploy-application.exe with a detection rule looking for the variable called path under HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\javaws.exe but this continues to show me that Java is uninstalled on devices I can clearly see the registry path there.

Thank you for any help you can give.

Top answer
1 of 5
10
I have found this script to do a full uninstall of all java versions and I will work with this as my remediation script. I just need to work on a detection script that works now, or a variable to do a detection with an app. $javaVer = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object {$_.URLInfoAbout -match "java" } | Select-Object -Property DisplayName, UninstallString ForEach ($ver in $javaVer) { If ($ver.UninstallString) { $uninst = $ver.UninstallString & cmd /c $uninst /quiet /norestart } } Sorry about the formatting, reddit did not make this code easy to post in the original format.
2 of 5
7
Had to deal with the same thing. Wrote this up. $LogPath = "C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\#Java - Removal.log" Start-Transcript -Path $LogPath -Append do  { try { $CheckApp = Get-Package -Name "*Java*" -Verbose -ErrorAction SilentlyContinue if  ($null -ne $CheckApp) { $appName = 'Java Auto Updater' # Set registry keys to search $registryUninstallx86 = 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall' $registryUninstallx64 = 'HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall' $regKeyList = $registryUninstallx86,$registryUninstallx64 # Grab info from registry ( $returnList =   ( $regKeyList | ForEach-Object{Get-ItemProperty ($_ + '\*')} | Select-Object DisplayName ) # Find matching apps by name $foundApp = ( $returnList | Where-Object {$_.DisplayName -like ('*' + $AppName + '*')} | Where-Object {$_ -ne $null} #strip null entries ) # If there were results If  ($foundApp) { # run the uninstaller for each result ForEach ($instance in $foundApp) { $dtStamp = Get-Date -Format 'yy.dd.MM.hh.mm.ss' $appSID = $instance.PSChildName $msiexecEXE = 'msiexec.exe' # arguments uninstall by app SID, quietly, suppress restart, and logs the process $msiexecArgs =  ( '/x ' + $appSID + ' ' + '/qn /norestart ' + '/L*V "C:\Windows\Logs\Uninstall_' + $appName + '_' + $dtStamp + '.log"' ) $null = Start-Process $msiexecEXE -Wait -ArgumentList $msiexecArgs -Verbose } } Get-Package -Name *Java* | Uninstall-Package -Verbose Remove-Item -Path "C:\ProgramData\Oracle" -Force -Verbose -ErrorAction SilentlyContinue -Recurse }
🌐
Bulk Crap Uninstaller
bcuninstaller.com
Bulk Crap Uninstaller - Remove large amounts of unwanted applications
Bulk Crap Uninstaller (BCUninstaller, BCU) is a free, open source program manager. It excels at removing large amounts of applications with minimal user input.
🌐
FileHippo
filehippo.com › download_java-uninstall-tool
Download Java Uninstall Tool 25.0.0.0 for Windows - Filehippo.com
March 17, 2026 - Java Uninstall Tool is a free utility application developed by Oracle. This handy tool allows you to find and uninstall versions of Java from your computer, improving security and freeing up space.
Rating: 4.6 ​ - ​ 1 votes
🌐
Claude Code Docs
code.claude.com › docs › en › discover-plugins
Discover and install prebuilt plugins through marketplaces - Claude Code Docs
April 15, 2026 - Run /plugin and go to the Installed tab to view, enable, disable, or uninstall your plugins.