Java Runtime Environment HKEY_LOCAL_MACHINE Error - java

I was trying to get rid of older versions of Java (since I still had 1.6 and I also had 1.7) on my Windows XP machine. Well uninstalling 1.6 I got an error about Java Runtime Environment. When I try and start up Java Control Panel it gives me this error:
The system cannot find the registry key specified:
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.7.0_05
I've tried to reinstall Java but that does nothing. And I can't fully remove Java because whenever I try it gives me an error saying there was an error in the installation. To be specific:
Fatal error during installation.
Any idea how I can fix this issue? It keeps me from doing a lot which is frustrating.

Author's note: This answer was written to address installations of Java, major versions 6 and 7. It may or may not work with versions of java that are newer or older, but it probably won't hurt to try. If you follow these instructions for a major version not listed, please comment whether you were successful or not.
Read all of the directions twice. This solution details a manual uninstall of java by modifying the windows registry. If you do not follow the directions, you can cause permanent damage to your windows installation and will need serious firepower to get it working correctly again. If you do not understand the risks, ask someone for help.
If you have any registry cleaners, get rid of them. This is probably their fault. I've never met one I liked and wouldn't let one touch my registry with a 10 foot read only pole.
If you're using a laptop, connect to a charger. If you have children, make them walk the dog. Find a quiet secluded place and hole yourself up in it with zero distractions for about 15 minutes.
Make a backup of the registry key "\HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft", save it somewhere safe.
Delete exactly the following and only exactly the following registry key and all of its subkeys: "\HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft". After you are done with this step, java is dead. Do not try to run any java programs at this stage, it almost certainly won't work.
Open "C:\Program Files" (and, if you're on a 64 bit machine, "C:\Program Files (x86)"). If you see folders called Java, rename them to "Java_". If you installed java to a nonstandard location, navigate to it and add an underscore to its name.
Download and install the latest version. The installation should complete with no issues. It should also overwrite any leftover chunks of the old installation that are left.
(optional) Uninstall java again. The uninstallation should go smoothly and it should properly dispose of any leftover resources installed by the broken installation. Reinstall when the uninstall is complete. Since you are installing the same version you just removed, this probably isn't necessary.
Final note: I have performed this surgery many times on other people's computers using teamviewer, and it has never gone wrong. In the social circles where I hang out, we call it a javaectomy. For reference, I hang out on IRC and help people with issues with minecraft. We think we have seen every possible java issue. This one is fairly common and caused by some combination of many concurrent java versions, registry cleaners, and interrupted or failed updates. Once you are done and have verified that the reinstallation has gone smoothly and without issues, you can remove your saved registry keys and delete the renamed java folders from "program files" and "program files (x86)" (remember to delete only the ones with an appended underscore, the one called Java was added by the reinstall and should be left as is.
Disaster recovery: In the unlikely event that something goes wrong, restore the renamed java folders and patch the registry keys with your backup to revert to the original (partially broken) state.

I must congratulate Wug for his/her contribution in removing old Java residues. I tried every Uninstaller available (free) to no avail. Except for a Caveat, everything Wug suggested works. The only Caveat is that after #6 (renaming Java Folder in Program Files), you must use the Windows Uninstaller. Why? Because if you try to install the downloaded Java, it will warn you that you already have Java installed. Run the uninstaller from the Add or Remove Programs (Control Panel). It will give you an error that it couldn't find the uninstaller and then it will remove the Java reference from the Add/Remove Programs. Then do installation of the downloaded Java file and you are free of the old Java references.
GREAT JOB, WUG!!

I faced this issue while updating Java on my machine to 1.8. I had opted for uninstall of existing version while the installation and it did something to the registry keys.This fix worked to me .
Uninstall all versions of JDK and JRE from your machine.
Restart it.
Install 1.7 JDK.
Then install whatever JDK you want.

Related

Problem wrapping .java to .exe using Launch4J but problem is likely version compliance

I have a problem trying to wrap a java .jar as .exe and feel like I have checked out all there was on here which was remotely related. But I still couldn't get it to work. All the questions I found which seemed similar only concerned a part of my problem and also, the solution didn't work for me (such as this Convert .jar to .exe using launch4j or this The compiler compliance specified is 1.6 but a JRE 1.8 is used and many more).
The Problem
So, in my concrete case, I need to wrap a small program to a Windows .exe for an elderly person to use (I can't expect them to run a .jar file themselves). I'm trying to get everything to run on 1.0.8, so that's Java 8.
The errors I get are, on the one hand, that the resulting .exe doesn't work, throwing a class error (indicating that there's a problem with the compiler compliance) when trying to run it.
Later on, trying around, I also got a compiler compliance warning in Eclipse, so that's likely the problem.
Then I also get an error concerning module-info.java. Just deleting the contents of the file seems to help (in terms of Eclipse warnings) but the final result also doesn't work.
I saw that you need Java 9 to use module-info.java. What do I have to do with this? I couldn't find any helpful answers on here (or maybe I didn't understand them).
What I've tried
I have both the JDK and JRE installed (enviroment var set to JRE). I tried a clean and rebuild (like suggested in a question I can't find anymore) but it didn't do anything.
I am not so famililar with Java and usually use Linux, so Windows problems are not so familiar to me. I have found myself a Windows machine to compile my program from (because there seem to have been Java version problems when using Launch4J under Linux, trying to get an .exe.)
Edit: If one of you can help me solve my problem under Linux, that would be my favourite kind of solution. I currently use Linux Mint 20 but I also have Ubuntu installed on a machine I can access.
In the end, I think my Launch4J problem is actually a pre-existing problem of my .jar file stemming from the errors outlined above which I'll sum up again below:
I have been trying around for ages but I always get
The warning: The compiler compliance specified is 1.8 but a JRE 14 is used
The error: Syntax error on token "module", interface expected
I think that I should have fixed the compliance (both in Build Path and Compiler in the Properties) but it still doesn't work and it seems I've tried all there is. The environment variable is set and all. (There also isn't a javac.exe in my folder in case that makes a difference? Someone said to download it again but it doesn't help. Also, I've tried it on the customer's computer. They had a javac.exe and the whole thing still didn't work altough throwing different errors.)
Contents of module-info.java
Regarding the module, as the asker of this question ("Syntax error on token "module", interface expected") has nothing but
module NameOfMyThingy {
}
Maybe some of you can help - would appreciate it!
Thanks!
Rather than using launch4j, I recommend that you take a look at jpackage, which is available in JDK 14 and 15. See Packaging Tool User's Guide. Note that for Windows you will also need to download the WiX toolset.

Issue with Reinstalling Eclipse After upgrading hard drive

I am a programming student that recently upgraded the hard drive in my laptop through a secondary service. This service was able to save and transfer over most files, but was unable to migrate over specific program files.
When trying to reinstall Eclipse I have encountered some major issues and problems I am looking to hopefully get help with.
The first issue is that through the Eclipse installer, when trying to install eclipse it would try to look for the previously used user file and spew out 100s of error messages when this failed. A workaround to get eclipse actually installed was to change the bundle pools to off.
The second and most major issue is that eclipse does not seem to recognize or have any in build libraries, as it does not even recognize what a string is. I have the JDK and JRE installed but when trying to compile is tells me that java has been installed incorrectly (which would make sense given my hack job of installing it).
Any help would be greatly appreciated. I have never had so much difficulty trying to simply install something.
Try deleting .m2 folder present inside C:/Users/<User Name>/.m2 and then reinstall Eclipse.

Accepted the automatic Java update and now can't open Eclipse,

I'm very new to Java and computing in general. Currently taking an intro to programming course revolving around Java.
I got a notification earlier about a Java update when I wasn't using it and accepted it without much thought. I just now tried to open Eclipse to start doing some homework and when I did, all I got was the following message:
A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations: C:/Program Files/Java/jre1.8.0_144/bin
I have no idea where to go from here. I can't get in touch with my web developer friend helped me set up Java on my computer originally, and my instructor isn't responding to emails. I've tried to fix things like this myself in the past and have only compounded the problem, so I'm reluctant to try anything I'm not certain about, which is to say I'm reluctant to try anything at all. Any help is appreciated.
First, try to find where your jdk locates. If you don't remember where you have installed it, try to search for jdk or jre folder in C:/Programm Files. Then go to Window -> Preferences -> Java -> Installed JRE's tab in Eclipse and set path to your jdk or jre.
Got it figured out from an old question- just had to change the text to the updated JRE in the Eclipse initializer. Thank you for your help!

Correct Java dependencies installed for eclipse ADT development

I have eclipse and the ADT bundle correctly installed on my home PC, and tried to install it on my laptop so I can work on my projects on the go. However, I either didn't set the java paths correctly, or installed them in the wrong place, because I can't get a default project to load without errors.
I have correctly:
-Installed the ADT bundle and launched eclipse without errors
-Created a workspace
-Correctly Installed both the jre8 and jdk1.8.0_05 in the location C:\Program Files\Java
I am very new to Android development, and I feel like I was lucky to set up the Java dependencies correctly on my home PC, no such luck this time from what the error look like...
However, when I try to make a basic "Hello world" project, I immediately get the following error:
The container 'Android Dependencies' references non existing library 'C:\Users\userName\workspace\appcompat_v7_3\bin\appcompat_v7_3.jar'
I have tried adding the library, by checking build configurations, but I don't understand fully whats going on to correctly solve the problem. Here is my workspace:
And lastly, I tried checking the build configurations to see that the libraries are, in fact, missing. Or something like that. I am not sure if I should just try to reinstall java and the jdk.
Build configuration:
Anyway, I'm not sure what I deleted, misplaced, uninstalled, or didn't install, but if anyone could point me to a solution I would be very grateful. If anyone has any other questions on my setup I will try and be as thorough as possible. Thank you!
In my experience I have had issues like this if not running eclipse as Administrator. Make sure that you aren't being blocked here.
EDIT: Please note Chris Stratton's concers regarding running an IDE as Administrator, as seen in the comments below.
EDIT 2: In my more recent experience, I have noticed that if I installed the SDK by copying and pasting the contents of the downloaded, compressed, folder to a destination rather than extracting it first, I would be required to run as Administrator. If this is the case, delete the SDK that you copied out of the compressed folder and simply extract the contents of the downloaded compressed folder. I am running Windows 7 so it is likely that this applies to all Windows 7 and 8 OS's.
In another case, I have also seen issues like this if the JRE is installed second rather than first. In this case, a reinstall of the SDK is probably all that is required.

How can you do a silent reinstallation of java?

I have a requirement where I need to reinstall the same version of JRE if the previous attempt of installation corrupts the JRE. corruption here means the missing of some binaries or mismatch of binaries from previous versions.
Can someone tell if there is any method to silently reinstall the jre?
I know that interactively we can reinstall the jre, where before reinstalling it shows the dialog to user for his approval. if he chooses to go ahead it succeeds. but through command line how to achieve it?
With the latest UAC(User Access Control) in windows it is impossible to install anything with escalating user permissions (to write something in Program Files) folder. So complete silence in installation is impossible.
If by silent you mean that user interacts only with UAC and nothing else, then you should look at the command line options for the setup file, by executing setup.exe /? on windows
After lot of searches I have found that silent repair or reinstall operation is not supported by jre. Still if we want to go with it we need to use the jre_x.x_x.msi which is extracted to the location C:\Users\\AppData\LocalLow\Sun\Java\jre1.6.0_20_x64. I am not sure it will work always. but if you are lucky it may work out.

Categories