?
Solved

How to UNINSTALL j2re-1_4_2_06-windows-i586-p.exe programmatically

Posted on 2004-11-29
14
Medium Priority
?
798 Views
Last Modified: 2012-06-21
How to UNINSTALL j2re-1_4_2_06-windows-i586-p.exe programmatically?

I want my uninstall program to be able to remove JRE programmatically.

How can I launch uninstall for JRE?

My install program install JRE in a subdirectory of the application.

E:\CFSConnect\j2re-1_4_2_06-windows-i586-p.exe /S /v"/qn INSTALLDIR=E:\CFSConnect\jre REBOOT=Suppress JAVAUPDATE=0"

I want my unistall program to be able to remove the above installed path.
0
Comment
Question by:Axter
  • 8
  • 5
14 Comments
 
LVL 92

Expert Comment

by:objects
ID: 12700123
try:

E:\CFSConnect\j2re-1_4_2_06-windows-i586-p.exe /s /v /qn /x
0
 
LVL 30

Author Comment

by:Axter
ID: 12700208
But I want to make sure it only uninstalls the JRE installed in the path I installed it in.

In other words, if another JRE is installed in c:\Program Files\Java\~~~~~,
I want to make sure my uninstall command does not try to uninstall that path.

How can I make sure the right JRE is uninstalled?
0
 
LVL 92

Expert Comment

by:objects
ID: 12700225
Are you using the same installer to install the same jre in different places?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 30

Author Comment

by:Axter
ID: 12700244
I just tried the command, and nothing happens.

Not even an error message.
0
 
LVL 30

Author Comment

by:Axter
ID: 12700257
>>Are you using the same installer to install the same jre in different places?

No.  My concern is that there may be a JRE already installed on the computer when my application runs the setup.
If my application gets uninstalled, I don't want to uninstall a JRE that may have been previously installed or installed after my application has been installed.
0
 
LVL 92

Expert Comment

by:objects
ID: 12700283
try:

E:\CFSConnect\j2re-1_4_2_06-windows-i586-p.exe /s /v "/qn INSTALLDIR=E:\CFSConnect\jre REBOOT=Suppress" /x
0
 
LVL 30

Author Comment

by:Axter
ID: 12700330
Nothing happens with above command either.
0
 
LVL 30

Author Comment

by:Axter
ID: 12701558
Seems the only way I can uninstall the JRE is via the following command line:
msiexec.exe /qn /x {7148F0A8-6813-11D6-A77B-00B0D0142060}

However, this does not do a specific path.
0
 
LVL 92

Expert Comment

by:objects
ID: 12701612
did you try specify the path using the INSTALLDIR property

INSTALLDIR=E:\CFSConnect\jre

And did you try running the earlier command not in silent mode to see whats happening
0
 
LVL 30

Author Comment

by:Axter
ID: 12701701
>>did you try specify the path using the INSTALLDIR property

For the msiexec.exe, or for j2re-1_4_2_06-windows-i586-p.exe command????

>>And did you try running the earlier command not in silent mode to see whats happening
No.

I'll see if I can test it out tomorrow.
0
 
LVL 92

Expert Comment

by:objects
ID: 12701732
>>>did you try specify the path using the INSTALLDIR property

>For the msiexec.exe, or for j2re-1_4_2_06-windows-i586-p.exe command????

msiexec
0
 
LVL 2

Accepted Solution

by:
jprgn earned 2000 total points
ID: 12703216
This link will solve your problem

http://www.appdeploy.com/articles/msi_kix/index3.asp

Here's the code

;===========================================
; JRE Install/Uninstall Script
;===========================================
 
$Version = "1.2"
 
If InStr($EXECmdLine,"uninstall")
      $UninstallCommand = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\JRE 1.2.2","UninstallString")
      If $UninstallCommand <> ""
            ? "Uninstalling JRE v" + $Version + "..."
            Shell $UninstallCommand + " -a"
      Else
            $ = LogEvent(1, 1605, "JRE was not found for uninstall","","KiXtart")
            GoTo End
      EndIf
Else
      If ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment", "CurrentVersion") = $Version
            $ = LogEvent(2, 4949, "JRE v" + $Version + " was already installed.","","KiXtart")            
            GoTo End
      Else
            $IEPath = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IE Setup\Setup","Path")
            If Exist(ExpandEnvironmentVars($IEPath) + "\iexplore.exe") $Plugins = "-iexplorer " EndIf
            $NS6ver = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Netscape\Netscape 6","CurrentVersion")
            $NSPath = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Netscape\Netscape 6\" + $NS6Ver + "\Main","Install Directory")
            If Exist("$NSPath") $Plugins = $Plugins + "-netscape6 " EndIf                  
            ? "Installing JRE v" + $Version + "..."
            ? "Plugin switches used: " + $PlugIns ?
            Shell '\\server\package_share\jre\jre-1_2_2_011-win.exe -s -a ' + $PlugIns + '-s -SMS -f1"\\server\package_share\jre\setup.iss"'
            $ = LogEvent(2, 4949, "JRE v" + $Version + " installation complete: " + @SERROR,"","KiXtart")
            Del "C:\Documents and Settings\All Users.WINNT\Start Menu\Programs\Java Plug-in Control Panel .lnk"
            $ = WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\JRE 1.2.2","DisplayName","","REG_SZ")
      EndIf
EndIf

:End
Exit
0
 
LVL 30

Author Comment

by:Axter
ID: 12706751
After running some test, I found out the install program will not install twice.
So if there is already another JRE if the samve version installed on the target machine, the setup will not reinstall JRE.

That means all I basically have to do is check the registry to see if the current installation is in my application path.
If it is, then I run the uninstall JRE command:
msiexec.exe /qn /x {7148F0A8-6813-11D6-A77B-00B0D0142060}

The registry key I'm using is
SOFTWARE\JavaSoft\Java Runtime Environment\1.4.2_06\JavaHome

Which tells me the path for the JRE version I'm installing.
0
 
LVL 30

Author Comment

by:Axter
ID: 12706762
jprgn,
Since your post got me looking in the right direction for the registry keys, I've awared you the points.

Thanks objects for trying.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month13 days, 8 hours left to enroll

750 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question