How to Remove all versions of Java

There are tons of older posts on this and nothing that is cut and dry. What is the best way to remove all versions of Java?

1 Comment   [ + ] Show comment
  • You may check the powershell command to do the same

    $computers = Get-Content "C:\temp\computers.txt"

    ForEach-Object ( $computer in $computers ) {

    $java = Get-WmiObject -ComputerName $computer Win32_Product | WHERE { $_.name -like "J2SE Runtime Environment*" }


    Joe - Joe Prior 5 years ago

Answers (4)

Answer Summary:
run on the system the following command: wmic product where "name like 'java%%'" call uninstall It can be automated.
Posted by: Nico_K 5 years ago
Red Belt

Top Answer

run this command:
wmic product where "name like 'java%%'" call uninstall

I do this as a KACE Script, following the installation of the most current Java version (or better the latest approved ;) )

  • Works perfect! Thanks Nico! - derrick499 5 years ago
Posted by: Joe Prior 5 years ago
Orange Belt
You may try the powershell script that i found on other forum

$computers = Get-Content "C:\temp\computers.txt"ForEach-Object ( $computer in $computers ) {    $java = Get-WmiObject -ComputerName $computer Win32_Product | WHERE { $_.name -like "J2SE Runtime Environment*" }    $java.uninstall()    }
Posted by: dedenker 5 years ago
3rd Degree Black Belt
The WMIC can work perfect indeed, but the win32_PRODUCT function is very buggy and slow.
And sometimes can trigger unwanted repairs, so just as a plan B:
You go over the registry path HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall and search for every hit on *JAVA* and then call the uninstall registry string (uninstallstring) in that key.
Because all software is registered there under there GUID code.

Here is a batch example

This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ