Home » Java » Core Java » Windows Registry Cleanup after JDK 9 Early Release Installation

About Dustin Marx

Dustin Marx

Windows Registry Cleanup after JDK 9 Early Release Installation

In my last blog post, I demonstrated resolution of issues surrounding the Oracle Java symbolic links (C:\ProgramData\Oracle\Java\javapath\ directory on Windows-based machines) after I had installed an early release of JDK 9 (build 68) that seemed to prevent automatic installation of earlier (more stable) Java versions from working properly. Even with the symbolic links fixed in the C:\ProgramData\Oracle\Java\javapath\ directory, I still was not completely “out of the woods” yet related to moving back to JDK 8 from the early release of JDK 9. I had some registry issues to address and this post summarizes that effort.

20150702-Java19RegistryKeyInsteadOfJava18

Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'
has value '1.9', but '1.8' is required.
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.

The first warning (“Error: Registry key ‘Software\JavaSoft\Java Runtime Environment’\CurrentVersion’ has value ‘1.9’, but ‘1.8’ is required.”) is addressed by changing the value of the registry described key (Software\JavaSoft\Java Runtime Environment\CurrentVersion) in exactly the recommended way (from 1.9 to 1.8 in my case).

The next screen snapshot shows my Windows 7 laptop’s Registry Editor (started from DOS with regedit command) before I fixed the issue. The circled version (“1.9”) is incorrect and right-clicking on the “CurrentVersion” key allowed me to select “Modify” and then to change the value field from 1.9″ to “1.8” (see How to Modify the Windows Registry for more details on modifying the Windows Registry). I did the same for the “CurrentVersion” in “Software Development Kit” area as I did for the shown “Java Runtime Environment” area.

20150702-regeditJavaCurrentVersion-19

The screen snapshot of the Registry Editor also displays the issue related to the other two aspects of the warning message (“Error: could not find java.dll” and “Error: Could not find Java SE Runtime Environment.”). As the screen snapshot demonstrates, there is no “1.8” area under “Java Runtime Environment” as there is for “1.6”, “1.7”, and “1.9”. I created a “1.8” area under “Java Runtime Environment” and created keys in that area adapted from the “1.7” keys. The result is shown in the next screen snapshot.

20150702-windowsRegistryWithJRE8

You might notice that I removed the JDK 9 entries from the registry. I did this because I was only experimenting with JDK 9 before and was now ready to move back to the latest version of JDK 8 for more common uses. Also, I still have access to the downloaded archive file from which I installed JDK 9 and could use it again if so desired, but I think I’ll be more likely to download the latest JDK 9 build (build 70 at time of this writing) and install it when I’m ready to experiment again with the latest JDK 9 has to offer.

Running “java -version” provides an easy way to determine that my Java runtime environment is working again.

20150702-java8up45IsBack

There are no more registry errors when running Java! I can also tell that the fix has been successfully applied because starting up JEdit no longer leads to the message I was seen earlier which is reproduced here:

20150702-javaRuntimeRegistryIssues

Bad or missing JRE/JDK registry entries can also affect Java IDEs and other Java-based applications, so it’s good to have that all cleaned up.

Perhaps the easiest approach (in terms of needing to know very little about the details of the Windows registry) for cleaning up Java registry issues on a Windows machine is to follow the advice to remove all versions of Java from the system and re-install. However, that may seem a bit drastic and other approaches are discussed in the StackOverlow thread Error when checking Java version: could not find java.dll: reinstallation, checking for conflicting environment variables in both SYSTEM and USER environment variables, direct registry manipulation.

(0 rating, 0 votes)
You need to be a registered member to rate this.
Start the discussion Views Tweet it!
Do you want to know how to develop your skillset to become a Java Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. JPA Mini Book
2. JVM Troubleshooting Guide
3. JUnit Tutorial for Unit Testing
4. Java Annotations Tutorial
5. Java Interview Questions
6. Spring Interview Questions
7. Android UI Design
and many more ....
I agree to the Terms and Privacy Policy
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments