Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove JRE entries from Windows registry?

Tags:

java

windows

By mistake I deleted Java folder from my Windows machine.
Now I'm getting problems in various plugins and all and it is asking me to download latest JRE. When I try to do that, it says JRE is already present, do you want to remove old JRE and install new one? I say yes and then it gives me error "1723".

So in short JRE is not getting uninstalled.
I reinstalled Java SDK, but still things are not working for me. I again uninstalled Java SDK, and tried to uninstall JRE..... it doesn't work.

So, I see the only way is to remove JRE entries from Windows registry.
I tried to use softwares like JavaRa, Revo Uninstaller, etc... but they did not help me.

Please let me know which JRE entries should I remove and where they are located!

like image 400
tecman Avatar asked Mar 24 '11 06:03

tecman


2 Answers

The JDK itself does not use the windows registry to run. It is the JRE that uses the system registry to run in some situations like an Applet or a program started with the WebStart technolgy.

Finally, the JRE will only use the registry if it is run from the Windows system directory (ex . C:/winnt/system32/java.exe). This would happen if the user just types "java" on the commandline in some random directory, because the system directory is always in the user's path. In this situation, the java.exe will locate the current Java installation by looking at the registry key

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion]

and then get the path of the JRE from the corresponding key

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.5\JavaHome]

Beware that some software (eg. Oracle) installs themself at the beginning of the PATH definition, so it's their Java installation that will be found first. You can run the absolute path to the java.exe file, as in

"C:\Program Files\Java\jre1.5.0\bin\java.exe" MyClass

It will not use the registry, and it will be guaranteed to use jre1.5.0. So for a regular Java SE program, it is safe to specify the complete path to the JRE to launch it.

But for the Applet/Plugin or WebStart-based programs, the registry is always used to determine the current JRE.

like image 190
developer Avatar answered Oct 24 '22 01:10

developer


I found a very good source of information to fix installer issues with Java in the following link:

http://forums.whatthetech.com/index.php?showtopic=104537

Seems the following registry entries in Windows must be deleted:

reg query hklm\software\classes\installer\products /f "java(tm) 6" /s | find "HKEY_LOCAL_MACHINE" > deljava.txt
for /f "tokens=* delims= " %%a in (deljava.txt) do reg delete %%a /f
del deljava.txt
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment" /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\wow6432node\JavaSoft\Java Runtime Environment" /f

Checked and it is working with Windows 7 x64.

Regards,

like image 8
will824 Avatar answered Oct 23 '22 23:10

will824