Error when checking Java version: could not find java.dll
Asked Answered
B

19

50

why do I get this? How can I fix it?

C:\Users\ash>java version
Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'
has value '1.7.0_01', but '1.7' is required.
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
Bathe answered 16/2, 2012 at 14:48 Comment(1)
Does 'java version' works? Coz, I use 'java -version'.Eppes
B
16

Reinstall JDK and set system variable JAVA_HOME on your JDK. (e.g. C:\tools\jdk7)
And add JAVA_HOME variable to your PATH system variable

Type in command line

echo %JAVA_HOME%

and

java -version

To verify whether your installation was done successfully.

Badajoz answered 16/2, 2012 at 15:56 Comment(4)
isn't variable value for JAVA_HOME supposed to be JRE?-confluence.atlassian.com/display/DOC/…Steffen
Can you show these steps in more details for beginners? Thank youProtoplast
@Steffen no, it's supposed to be the root folder of your JDK if I remember correctly.Hopple
JAVA_HOME isn't used by Java, only by IDEs, Tomcat, etc. All you need is a correct PATH setting that yields the JDK or JRE java.exe first, not some ancient dumb Windows thing.Stockbreeder
S
47

The accepted solution for Reinstalling ALL JDKs was a bit harsh. I too experienced this problem and here is my 2 cents:

This problem started happening since I installed JDK 8 and still had JDK 6 installed. I need for different projects I'm working on.

I noticed I had both a User and a System %JAVA_HOME%, so I removed my User %JAVA_HOME% variable and left only the system one.

I also noticed that in my Oracle installation there was some Java executables and I believe those where the ones conflicting since both my Oracle and Java installations were in my %PATH% variable.

I removed all Java paths from my %PATH% Variable and only left the %JAVA_HOME%\bin at the start of the variable for avoiding any conflicts with the Oracle installation.

Subprincipal answered 27/11, 2014 at 12:11 Comment(1)
I had an errant java.exe in Windows/System32. I removed it and all is well.Peddler
A
42

I had a similar issue after installing the java 1.8.

To fix this go to Advance System setting --> path and remove

C:\ProgramData\Oracle\Java\javapath;

Ametropia answered 17/8, 2016 at 21:45 Comment(1)
Or move the entry you need higher than that oneHopple
C
19

Removing

C:\ProgramData\Oracle\Java\javapath;

work like charm

Cultivable answered 27/3, 2018 at 2:28 Comment(1)
Had the same problem. I moved my JDK up in the list so I didn't have to remove the entry.Hopple
B
16

Reinstall JDK and set system variable JAVA_HOME on your JDK. (e.g. C:\tools\jdk7)
And add JAVA_HOME variable to your PATH system variable

Type in command line

echo %JAVA_HOME%

and

java -version

To verify whether your installation was done successfully.

Badajoz answered 16/2, 2012 at 15:56 Comment(4)
isn't variable value for JAVA_HOME supposed to be JRE?-confluence.atlassian.com/display/DOC/…Steffen
Can you show these steps in more details for beginners? Thank youProtoplast
@Steffen no, it's supposed to be the root folder of your JDK if I remember correctly.Hopple
JAVA_HOME isn't used by Java, only by IDEs, Tomcat, etc. All you need is a correct PATH setting that yields the JDK or JRE java.exe first, not some ancient dumb Windows thing.Stockbreeder
L
6

I had a similar issue after installing the java 10.0

To fix this go to Advance System setting --> path and remove

C:\ProgramData\Oracle\Java\javapath;

Lacedaemonian answered 10/10, 2018 at 1:44 Comment(0)
E
6

I had to remove the Common Files javapath from the 'Path' that was conflicting, in order to make it work. Now thankfully the java -version works just fine.

C:\Program Files (x86)\Common Files\Oracle\Java\javapath
Evaluate answered 30/4, 2019 at 15:53 Comment(0)
H
5

Make sure your JDK Path variable is directing to the \bin folder and is at the top of the list, because it always uses the first match. By moving it to the top you can make sure that no other path is matched first.

If there's any other entry that has a file called java (such as C:\ProgramData\Oracle\Java\javapath) it will run the command against that file instead of the java file in your JDK. There's no need to reinstall the entire JDK unless your files are corrupt or damaged for some reason.

Hopple answered 31/5, 2018 at 17:10 Comment(0)
I
5

This problem generally occurs in Windows when your "Java Runtime Environment" registry entry is missing or mismatched with the installed JDK. The mismatch can be due to multiple JDKs.

Steps to resolve:

  1. Open the Run window:

    Press windows+R

  2. Open registry window:

    Type regedit and enter.

  3. Go to: \HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\

  4. If Java Runtime Environment is not present inside JavaSoft, then create a new Key and give the name Java Runtime Environment.

  5. For Java Runtime Environment create "CurrentVersion" String Key and give appropriate version as value:

JRE regedit entry

  1. Create a new subkey of 1.8.

  2. For 1.8 create a String Key with name JavaHome with the value of JRE home:

    JRE regedit entry 2

Ref: https://mybindirectory.blogspot.com/2019/05/error-could-not-find-javadll.html

Immethodical answered 6/5, 2019 at 7:47 Comment(0)
E
2

I edited my path to put the Oracle JDK at the start of the path and that fixed it.

Endeavor answered 19/8, 2016 at 15:27 Comment(0)
H
2

Problem: We had the same problem in our Windows 2012 server. We used JAVA_HOME environmental system variable, an we used in the PATH this kind of settings: ...%JAVA_HOME%/bin;... and no other java related settings was in the PATH.

The problem was we had a space at the end of the value of the JAVA_HOME variable. Like 'C:\Program Files\Java\Jdk 1.8.0_172 ' so the %JAVA_HOME%/bin meant 'C:\Program Files\Java\Jdk 1.8.0_172 \bin'. So because the value was split by space and the system tried to find java.exe at 'C:\Program Files\Java\Jdk 1.8.0_172' where it is obviously not.

Solution was: Delete the space from the end of value of the JAVA_HOME !

Heresiarch answered 5/7, 2018 at 13:29 Comment(0)
B
2
  1. Uninstall Java from machine
  2. Check Java folder is deleted from Program Files
  3. Check Registry does not have any instance of Java
  4. Open system Variables and delete the ONLY java path from PATH
  5. Now install the new version again.
  6. Set the Path in System Variables.

This process cleans up all the traces of java and then install fresh java.

Note: This issues occurs when there is multiple installation and uninstall done.

Boatload answered 6/1, 2019 at 18:43 Comment(0)
C
1

You could be using a 32 bit version of java on a 64 bit environment. Export the registry hive form HKLM\Software\JavaSoft and import into HKLM\Software\Wow6432Node\JavaSoft. For 1.6 I only needed JavaHome and RuntimeLib values.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Javasoft]

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Javasoft\Java Runtime Environment]
"CurrentVersion"="1.6"

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Javasoft\Java Runtime Environment\1.6]
"JavaHome"="C:\\Java\\jre"
"RuntimeLib"="C:\\Java\\jre\\bin\\client\\jvm.dll"
Carpous answered 9/4, 2013 at 12:32 Comment(0)
L
1

None of the above worked for me, unfortunately. The error solved when I uninstalled the old JDK versions that were installed on my computer. I did it simply with the "Uninstall or change a program" tool (under the Control Panel).

Lymphocyte answered 17/12, 2019 at 12:13 Comment(0)
S
0

I removed the "C:\Program Files (x86)\Heroku\bin" from PATH variable and the problem has gone. I think it is probably the Heroku require different version of Java. So check all directories in your PATH variable, remove the possible ones may have confliction.

Schear answered 23/1, 2018 at 14:24 Comment(0)
D
0

If you face this error in cmd with another error as "could not find runtime environment" after you have done all settings in Environment Variable. Then you just need to run jre.exe in your jdk folder and reinstall it and then recheck it by java -version command. Hope it will help you.

Delinquent answered 9/8, 2018 at 12:19 Comment(0)
C
0
  1. rename file "C:\Windows\System32\java.exe" to "C:\Windows\System32\java_old.exe"
  2. CMD --> java -version

done.

Cookhouse answered 13/12, 2018 at 3:11 Comment(0)
H
0

In my case the regedit information was correct and the problem was solved by doing the below:

1) setting JAVA_HOME to jdk - set JAVA_HOME=C:\Program Files\Java\\bin 2) setting PATH to jre - set PATH="C:\Program Files\Java\\bin"

Hutchison answered 9/6, 2019 at 17:24 Comment(0)
S
0

after adding the requirements path as illustrated up and deleting C:\ProgramData\Oracle\Java\javapath;. don't forget to reopen your editor.

Simulcast answered 15/11, 2020 at 9:20 Comment(0)
B
0

Go to CMD and type the following: SET PATH=C:\Program Files\Java\jdk1.8.0_291\bin

(here jdk1.8.0_291 represents your java version, it may differ for you)

Bilabial answered 21/6, 2021 at 20:26 Comment(2)
its a temporary solution, you have do this manually every time.Bilabial
for permanent solution go to your eclipse directory and open eclipse configure file add add this two lines just before -vmargs: -vm C:\Program Files\Java\jdk1.8.0_291\binBilabial

© 2022 - 2024 — McMap. All rights reserved.