How to uninstall Java SE from the command line

104,707

Solution 1

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.

Solution 2

There are 2 places where you might find the product code:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\4EA42A62D9304AC4784BF238120662FF\InstallProperties

or

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

You should be able to find the uninstall string from the key UninstallString; something like: MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83216026FF}

Share:
104,707
abhishek
Author by

abhishek

Falling of bikes since 1975

Updated on September 17, 2022

Comments

  • abhishek
    abhishek over 1 year

    Oracle states that the Java SE installer is built using MSI, but the help page, rather unhelpfully doesn't list uninstall options.

    I need to do a command line uninstall, and I can't figure out or find relevant the options for 1.6.21

    I've tried wrapping the installer .exe in msiexec using msiexec /q /x <jre>.exe, but this just reports that the installation package could not be opened.

    Running the installer .exe with the /s /x option just hangs.

    Edited to add: msiexec /x {3248F0A8-6813-11D6-A77B-00B0D0160021} /q => "This action is only valid for products that are urrently installed"

    Anyone got the right command line?

    • Admin
      Admin about 13 years
      Can't you uninstall it from Control Panel -> Add/Remove Programs
    • abhishek
      abhishek about 13 years
      It's for a compute cluster so ideally it needs to be command line uninstall.
  • abhishek
    abhishek about 13 years
    Installing JDK 1.6u21 onto a local PC allowed me to see that the GUID isn't the one I was expecting (based on Oracle docs & Server Fault). A JRE/JDK difference. reg query HKLM\Software\Microsoft\Windows\CurrentVersion\Uninstall\{32‌​A3A4F4-B792-11D6-A78‌​A-00B0D0160210} /v uninstallString
  • abhishek
    abhishek about 13 years
    hmm, on the compute nodes MSIEXEC reports that action is only valid for products that are installed and reg query /s HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion‌​\Uninstall has no record of the JDK being installed.
  • Edward J Beckett
    Edward J Beckett about 11 years
    +1 This method worked well to uninstall a botched SQL Server 2012 rsfx driver package.
  • uniquegeek
    uniquegeek over 7 years
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion‌​\Uninstall references the 64-bit programs. It is likely you may also need to check HKEY_LOCAL_MACHINE\WOW6432Node\SOFTWARE\Microsoft\Windows\Cu‌​rrentVersion\Uninsta‌​ll for 32-bit programs. Java can be installed as either, or both at the same time
  • SimplyInk
    SimplyInk about 7 years
    referencing above registry key, the correct path for my Win10 machine is REG QUERY "HKLM\Software\WOW6432Node\JavaSoft" WOW6432Node should be after SOFTWARE