How to remove JRE entries from Windows registry?

后端 未结 3 954
离开以前
离开以前 2020-12-16 16:26

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 l

相关标签:
3条回答
  • 2020-12-16 16:55

    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,

    0 讨论(0)
  • 2020-12-16 16:56

    I removed JAVA_HOME from my environment variables, and my path, and then I was able to remove the folder and reinstall both jdk and jre.

    0 讨论(0)
  • 2020-12-16 17:02

    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.

    0 讨论(0)
提交回复
热议问题