5 Replies Latest reply: Jan 24, 2013 10:04 AM by 986955 RSS

    JRE Uninstall string for v7 all the same - but do not work

    985070
      We have multiple Windows 7 machines running v7u1 thru v7u10.

      I found the uninstall string and was able to run MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83217010FF} on my own machine to remove the software successfully.
      In looking at u6,u7,u9 and u11 installations, I noticed the Uninstall Strings are exactly the same. But when ran on those machines, the system states "This action is only valid for products that are currently installed".

      However, I can remove the version from the Control Panel.

      So what are the correct uninstall strings for v7u1 thru v7u11?
        • 1. Re: JRE Uninstall string for v7 all the same - but do not work
          985179
          1st question. Why uninstall?

          You can just install the new version over the top (assuming you did a normal install previously)

          The uninstall string is slightly different for each version look at the last 5 characters in the string it has the version number IE. 17009 or 17010 etc

          So for 1.7.0.09
          MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83217009FF}

          1.7.0.10
          MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F83217010FF}

          Hope that helps.
          • 2. Re: JRE Uninstall string for v7 all the same - but do not work
            gimbal2
            982176 wrote:
            1st question. Why uninstall?
            Whats your second question then, huh? ;)

            Uninstalling first is a safety strategy that has been applied to Windows environments since its inception. In the case of Java, upgrades are not guaranteed flawless depending on the environment it installs in, just take a stroll through the history of this particular sub-forum to see the proof. I must say that even though I know what I'm doing, I too tend to just uninstall all existing runtimes and JDKs and then reinstall the latest ones; I tend to have multiple installed being a developer (32 bits, 64 bits, runtime, JDK) and I'd like to have to prevent doing system restores because the stars are not aligned properly :/
            • 3. Re: JRE Uninstall string for v7 all the same - but do not work
              984793
              All of our users are local admins and tend to install whatever. This leads to a messy environment and we don't always know which version of Java is installed. So, to address that, I created a small script that scours 'HKLM\software\microsoft\windows\currentversion\uninstall' for Java entries, reads the uninstall string then runs the reported uninstall string. The assumption here is that the uninstall string will be an MSI command. (All the machines & versions of Java used the same format.)

              This is a Windows 7 Enterprise (32-bit) environment, but the script also works on 64-bit installations of Windows 7 Enterprise.

              I've tested this with 7u11 and went as far back as 6u21. It should work with just about any version that uses MSI for uninstalling.
              @echo off
              setlocal enabledelayedexpansion
              
              echo. & echo Checking for Obsolete Versions of Java...
              
              for /f "usebackq tokens=*" %%a in (`reg query HKLM\software\microsoft\windows\currentversion\uninstall`) do (
                   rem echo a is %%a
              
                   for /f "usebackq tokens=2*" %%b in (`reg query "%%a" /v DisplayName 2^>nul ^| find /i "java"`) do (
                        rem echo b is %%b
                        rem echo c is %%c
              
                        for /f "usebackq tokens=3,4" %%d in (`reg query "%%a" /v UninstallString 2^>nul`) do (
                             echo.     Removing %%c
                             rem echo d is %%d
                             rem echo e is %%e
              
                             set uninstallcmd=%%e
                             set uninstallcmd=!uninstallcmd:^/I=^/X!
              
                             rem %%d %%e /qb-
                             %%d !uninstallcmd! /qb-
                        )
                   )
              )
              
              :end
              endlocal
              Standard Dislaimer:*
              Neither I nor the respective owners and/or maintainers of Oracle make representations about the suitability of this software for any purpose. This material is provided "as is", with absolutely no warranty of the attached items whatsoever, whether express, implied, or statutory, including, but not limited to, any warranty of merchantability or fitness for a particular purpose or any warranty that the contents of the item will be error-free. Any use is at your own risk. Blah blah blah.
              • 4. Re: JRE Uninstall string for v7 all the same - but do not work
                985070
                Thanks all - I will look at all of these and hope that works out!
                • 5. Re: JRE Uninstall string for v7 all the same - but do not work
                  986955
                  Great Script! This worked like a charm. For some reason though the script throws an error that says something like "Command not found "Version"" but it still works. I just chose to ignore the error and use the script as-is.

                  Thanks for the work on this. this is by far the best way to uninstall java (or anything else!)