How to Remove all versions of Java
Average Rating: 5 based on 4 votes
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
Answers (4)
Answer Summary:
run on the system the following command: wmic product where "name like 'java%%'" call uninstall It can be automated.
run on the system the following command: wmic product where "name like 'java%%'" call uninstall It can be automated.
Please log in to answer
Posted by:
Nico_K
9 years ago
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 ;) )
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 ;) )
Comments:
-
Works perfect! Thanks Nico! - derrick499 9 years ago
Posted by:
Joe Prior
9 years ago
Posted by:
dedenker
9 years ago
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
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
$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()
}
Thanks
Joe - Joe Prior 9 years ago