15

These are the errors I get when I try to run a simple java version in the command window.enter image description here

I followed the advice on Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'?. When I went on regedit, here's what I saw

Which meant that there was nothing to change - right runtime version. I then did the next step which was to "delete all previous versions of Java (using "Programs and Features" uninstall process) and then re-install just the version you want to work with" However, that didn't work either...... Here is my current java directory(see that i have everything installed) enter image description here

And my current environmental variables are

JAVA_HOME - C:\Program Files\Java\jdk1.7.0_71

Path - C:\Program Files\Java\jdk1.7.0_71\bin

which i believe are correct as well from http://www.oracle.com/technetwork/java/javase/install-windows-189425.html

Does anyone know how i can get rid of this issue? I could do one more uninstall/install but I think that be a waste of time and won't make a difference.

Community
  • 1
  • 1
committedandroider
  • 8,711
  • 14
  • 71
  • 126

6 Answers6

6

I want to thank @almas-shaikh for this answer. His comment made me check over C:\Program Files\Java\jdk1.7.0_71\jre\bin and see that there was no java.dll library file inside that directory. What I did next was just deleting the jdk and reinstalling it via jdk-7u71-windows-x64.exe executable. Now when I execute java -home, I get enter image description here

Now the part I don't get is how the java.dll library file was deleted in the first place......

committedandroider
  • 8,711
  • 14
  • 71
  • 126
  • 1
    I do have my java.dll in place but I'm still getting the error. Any idea why? – Awani Apr 07 '17 at 13:26
  • Confusing documentation and installation process by Oracle. For anyone else without missing DLLs, turns out the jdk installer doesn't automatically setup the JAVA_HOME environment variable so once you set that appropriately, `java -version` should work. – janoulle Dec 30 '19 at 17:40
1

Please try the steps. I hope, it will help you.

Step 1: Delete all previous versions of Java (using "Programs and Features" uninstall process). If java folder is remain in "C:/Program Files/...", please delete it.

Step 2: Clean up your registry(delete your java key). Please follow the below link for step by step clean up
https://java.com/en/download/help/manual_regedit.xml

Step 3: Reinstall Java and sets system variable JAVA_HOME to your JDK path.
Eg:
JAVA_HOME - C:\Program Files\Java\jdk1.7.0_71
Path - C:\Program Files\Java\jdk1.7.0_71\bin

Step 4 If step 3 is success, check with below command
1) echo %JAVA_HOME%
2) java -version

Ye Win
  • 2,020
  • 14
  • 21
1

I had similar problem. Turns out, even when you have 64-bit OS, your browser is most likely 32-bit and therefore your JAVA too. You need to manually install 64-bit JAVA.

I hope that will help.

0

try adding "%JAVA_HOME%\bin;" in the Path section instead of this "C:\Program Files\Java\jdk1.7.0_71\bin", should make no difference but just try it like this.

aurelius
  • 3,946
  • 7
  • 40
  • 73
0

java installation will create a folder similar to this C:\ProgramData\Oracle\Java. rename and again try cmd java -version.

make sure you have path variable set to latest jre/bin folder

Srijib Mandal
  • 585
  • 6
  • 12
0

I haven't seen this answer, but this is how I ran into the problem and then solved it.

I had Java 14.0.2 installed and I needed IntelliJ and Maven installed. This computer is an enterprise computer so I didn't have much saying on the installation process. I suppose IntelliJ came with Java 10.0.1 or that IT installed it as part of their process and it of course threw all my system out of the window.

So to fix this, I had to get someone from IT to unlock the admin things for me, and then:

  • I deleted the JRE paths with 10.0.1
  • Under the Windows tool to uninstall software, I deleted Java 10.0.1 JRE and JDK.
  • Under the Java directory, also moved or deleted those folders
  • And then I tested IntelliJ and the Terminal with java -version and javac -version to check if I was getting the same results (got 14.0.2, nice, that is what I was expecting)
  • And then checked Maven with mvn -version for the apache feedback as well, which will also return which JDK it's running.

No need to fiddle with registry, or even restart the computer (just to restart the Terminal after Path changes).