After years of working OK, I'm suddenly getting this message when trying to start the JVM:
Error: could not open `C:\Program Files\Java\jre6\lib\amd64\jvm.cfg'
I tried uninstalling, and got a message saying a DLL was missing (unspecified)
Tried re-installing, all to no avail.
At the same time, when trying to start Scala I get:
\Java\jdk1.6.0_25\bin\java.exe was unexpected at this time.
Checked %JAVA_HOME% and %path% - both OK
Can anyone help?
I checked my environment variables - JAVA_HOME & PATH and they all refer to C:\java. So this was bit frustrating. After sometime I found that the default installation also copied java.exe, javaw.exe and javaws.exe to C:\Windows\System32 (i.e. uninstall of JRE didn't go well). I just removed them and voila, I'm back on track. That annoying error is no longer popping.
This works for me
So, If exists, remove java.exe, javaw.exe and javaws.exe from System32
put %JAVA_HOME%\bin at the begin of PATH.
Might be a slightly different cause, but that second issue occurs for me in scala 2.9.0.1 on Win7 (x64), though scala-2.9.1.final has already resolved this issue mentioned here:
\Java\jdk1.6.0_25\bin\java.exe was unexpected at this time.
My %JAVA_HOME% set to a path like this: c:\program files(x86)\Java\jdk...
Note the space and the parentheses.
If you change line 24 in %SCALA_HOME%\bin\scala.bat from:
if exist "%JAVA_HOME%\bin\java.exe" set _JAVACMD=%JAVA_HOME%\bin\java.exe
to
if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
It works fine. Note the quotes around the set command parameters, this will properly enclose any spaces and 'special' characters (eg: spaces and parentheses) in the variable's value.
Hope this helps someone else searching for an answer.
I had a slight different solution to this problem. my PATH and JAVA_HOME were pointing to JDK12 in
C:\Program Files\Java
but execution of the command:
Java -version
gave the error:
Error: could not open `C:\ProgramFiles\Java\jre1.8.0_212\lib\amd64\jvm.cfg'
I had to delete a folder of executables (Java.exe, javaw.exe etc.) in a different directory than System32, as other answers here and blog posts have suggested. Instead I found the problem lied with executables found in:
C:\Program Files\Common Files\Oracle
as there was nothing Java related in
C:\Windows\System32
If you're having this issue and nothing is in System32, check this "common files" directory mentioned above for an oracle directory and delete it.
After, your PATH references should work fine!
I had the same problem: I have a 64 bit Windows and when I typed "java -version" in CMD-Console i received the same Error message.
Try to start a 64bit-cmd(C:\Windows\SysWOW64\cmd.exe) and you will see, it works there ;)
C:\ProgramData\Oracle\Java\javapath
I took a back up of the files in it and removed those files from there. Then I opened a new cmd prompt and it works like a charm.
If this was working before, it means the PATH isn't correct anymore.
That can happen when the PATH becomes too long and gets truncated.
All posts (like this one) suggest updating the PATH, which you can test first in a separate DOS session, by setting a minimal path and see if java works again there.
Finally the OP Highland Mark concludes:
Finally fixed by uninstalling java, removing all references to it from the registry, and then re-installing.
scary ;)
I thought I will share how I resolved the same issue "Error Could not open lib\amd64\jvm.cfg". I found the Java run time Jre7 is missing amd64 folder under lib. However, I have 1.7.0_25 JDK which is having jre folder and also having amd64.
I moved the original contents of jre7 folder to a backup file and copied everything from 1.7.0_25\jre.
Now I am not getting this error anymore and able to proceed with scene builder.
The Java 7 install on my work PC broke after a patch was forced out to us, giving this error any time you tried to run a Java program. Somehow the entire 'lib' subdirectory of the Java 7 install vanished! Might have been related to having both Java 6 and Java 7 installed -- the 'jre6' directory still had everything there.
In any case, I fixed it by uninstalling both Java 6 and Java 7 and reinstalling just Java 7. But if the file it's complaining about is actually there, then you're likely having a path issue as described in some of the other answers here.
Had suddenly the same Problem, from one day to another eclipse said
Failed to load the JNI shared library "C:/JDK/bin/client/jvm.dll"`.
after trying to run java on the console
Error: could not open `C:\WINDOWS\jre\lib\amd64\jvm.cfg'
now i just deleted the whole directory
C:\WINDOWS\jre
and everything worked again... i don't know there this jre came from, i hope it was not a virus
Another workaround is using shortpath in windows:
open windows command console using cmd.exe
goto c:\
type command> dir program* /x
it should display as short path like: PROGRA~2
so C:\PROGRA~2 is same as C:\Program Files (x86)
in your JAVA_HOME replace path to :
C:\PROGRA~2\Java\jre7
This should work in windows 64 environment as it worked for me in win7 64bit version.
I have changed the java installation path from c:\Program Files (x86)\java to another folder like c:\java\jdk1.7 and updated the %Java_HOME% and path values accordingly,it worked.
example
%JAVA_HOME% = C:\java\JDK1.7
path-C:\java\JDK1.7\bin;
I had the same problem in Eclipse and I fixed it by changing the JRE from 64 bit to 32 bit:
Window > Preferences > Java > Installed JREs > Add... > Next > Directory > select "C:\Program Files (x86)\Java\jre1.8.0_65" instead of "C:\Program Files\Java\jre1.8.0_60"
I had a similar problem (trying to start a Jenkins slave agent on Windows) on Windows 2008R2, Java 1.7.0_15
I had two situations that contributed to the problem and that changing both of them fixed it:
1) Installing Java in a unix-compatible path (changing from c:\Program Files\... to c:\Software\...); I don't think this directly affected the problem described in this thread, but noting the change;
2) Running Java not through a shortcut. It originally failed with a shortcut, but re-running from the direct executable (C:\Software\Java...\bin\java) worked.
Reinstalling java didn't help me. But the trick to put the JAVA_HOME variable at the beginning of the env-vars. The problem occoured after an upgrade from jdk1.7.0_11 to jdk1.7.0_13
I had this problem after updating your java. The best way to solve this problem is just go to your c:/ProgramFiles/Java folder. There you will find two jre folders one is as jre.your version and other with exactly like jdk folder. Try to remove jre.1.your version folder. There you go your problem is solved. Hope this might help. It's worked for me.
Typically it because of upgrading JRE.
It changes symlinks into C:\ProgramData\Oracle\Java\javapath\
Intall JDK - it will fix this.
Error: could not open `C:\Program Files\Java\jre6\lib\amd64\jvm.cfg'
Looking # it the issue of post install script is there and getting propagated since I am using update jdk8 1.8.0_191 since issue occurred with me after installing update of java and which was happened automatically.
Error: could not open `C:\Program Files\Java\jre1.8.0_191\lib\amd64\jvm.cfg'
This will be never ending in this case and need to do workaround like changing path's manually.
Delete the jars under system32 for windows.
Delete the jars under C:\Program Files\Common Files\Oracle
Edit the environment variable set JAVA_HOME and SET PATH to bin
I have solved this issue by deleting the Oracle folder from Program Data. And also delete the oracle java path associated with that folder from environment variables.
I kept variable name as "Path" but it did not work after changing it to "PATH"
started working for me.
variable name: PATH
variable value: C:\Program Files\Java\jdk-19\bin
this will work.
It wasn't in the path. Finally fixed by uninstalling java, removing all references to it from the registry, and then re-installing. None the wiser, but back working again. Thanks all #Highland Mark- Can you tell me the process to removing references from registry. I tried all possible way people mentioned here, nothing worked.
If you have downloaded several Jdks you have to delete all except of the JDK you want to use!
Related
please help. while running the NetBeans 8.2 installer, it says jdk not found on this computer. specify jdk location using "javahome installer argument". i went to the command prompt and ran the installer from there. i gave the address of the installer then --javahome "the directory of the jdk" . and it still does not run. please help me. I dont know what to do. I have tried every solution i came across but nothing works. can somebody please explain what is the problem? I have jdk 9.0.1.
First, make sure you install JDK (not JRE) on your computer.
Then, open file {path-to-netbeans}/etc/netbeans.conf and edit a line netbeans_jdkhome to
netbeans_jdkhome="C:\Program Files\Java\jdk1.8.0_144"
Such self-sure responses, such finality, all apparently basically wrong. (For three years.)
This problem appears to be a finicky demand by a lazy installer programmer. I put the JDK on the E: drive. I got past the problem with:
Apache-NetBeans-12.4-bin-windows-x64.exe --javahome E:\jdk-16.0.1\
(Note the double hyphen, as you apparently knew to do [the installer's error message box shows only -javahome] and note that putting quotes around it failed, but removing the quotes worked.)
I ran into the same, the following worked for me with Apache 12.6
Apache-NetBeans-12.6-bin-windows-x64.exe --javahome "c:\Program Files (x86)\Java\jdk1.8.0_321"
Best of luck note the double hyphens in JAVA_HOME and double quotes in JDK location. The Netbeans error screen suggests a single hyphen, but that did not work for me
I wanted to start my first build with ionic. But the Build fails very soon with the following error:
Running command: E:\Apps\ASV\Node\node.exe E:\Apps\ASV\Code\MyASV\hooks\after_prepare\010_add_platform_class.js E:\Apps\ASV\Code\MyASV
add to body class: platform-android
Error: Failed to run "java -version", make sure that you have a JDK installed.
You can get it from: http://www.oracle.com/technetwork/java/javase/downloads.
Your JAVA_HOME is invalid: C:\Program Files\java\jdk1.8.0_77
I tried several things over the past hour to fix this. I deinstalled all Java related stuff, reinstalled it, set the JAVA_HOME several times to the jdk path, added %JAVA_HOME%\bin to the path-variable, but nothing fixed it. Currently my JAVA_HOME, which i had to create manually, looks like this at the moment:
C:\Program Files\Java\jdk1.8.0_77
Please note that this path is different to the one in the error message. The 'Java' is written in lowercase and in uppercase, I don't know if this is relevant. Also changing this JAVA_HOME variable and then trying a rebuild gives the same error, the changed variable seems to have no effect on the one ionic uses.
How can I fix this? What exactly is going wrong?
it should be pointing to JDK\bin folder , usually C:\ProgramFiles\Java\jdk*\bin directory.
I recently tried in my new windows PC and gone through same issue.
Okay, i fixed it. The Error
Your JAVA_HOME is invalid: C:\Program Files\java\jdk1.7.0_79
Is quite irritating. The error was that the PATH-variable missed an entry like
C:\Program Files\Java\jdk1.7.0_79\bin
Somehow
%JAVA_HOME%\bin
still causes the error.
You will need to edit your enviroment variables of your box to point the JAVA_HOME to the currnent jdk bin/ directory
the problem is that I upgraded to Windows 10 and now I'm installing my tools to programming and now that I installed the JDK 7 of Java, when I try to use in the cmd the command:
- "javac"
The result of this is: "javac" is not recognized as an internal or external command...
But I was edited the PATH with the correct link of jdk, because when I use "java", it is ok.
Now, I tried in the console with this command: PATH=%PATH%;"C:\Program Files\Java\jdk1.7.0_79\bin"
And when I executed the command "javac" it works, but now, when I open other console, it doesn't work, or when I restart the console, this command is not recognized.
What could be the problem?
java is part of the JRE, not the JDK.
You need to add the JDK bin to the system PATH, in
"Control Panel" | System | Advanced | "Environment Variables"
Her's how I configure System variable on Windows 10 :
I am totally new to java and spent hours trying to get the problems with PATH and CLASSPATH worked out. There was one person who said to restart the command prompt after you modify the environment variables; that was it for me. While you are testing different configurations, make sure to relaunch the command prompt before testing. It seems like there are at least 2 different ways of setting this up. I went with the following:
1) In System Variables, add
JAVA_HOME = c:\program files (x86)\java\jdk1.8.0_121
2) In System Variables, add the following to existing Path...
%JAVA_HOME%\bin
That's it.
No need for quotes around anything. No double forward slashes or anything else. I think it would also work if I removed the java_home variable and just listed the explicit path to bin in the PATH variable, but I'm not touching it again now that it finally works.
After adding C:\Program Files\Java\jdk1.8.0_73\bin to the system variables I turned off my command prompt and opened another one. Then it worked.
Maybe a bit late, but i had same problem.
Click on "Move up" button for Java path and move it at top.
It fixed problem for me
just add C:\Program Files\Java\jdk1.7.0_80\bin as the path in environmental variables. no need to add java.exe and javac.exe to that path. IT WORKS
I added below Path in environment variable
;%JAVA_HOME%/bin instead of %JAVA_HOME%\bin
in my case , it fix the problem
I had the same issue on Windows 10 - the java -version command was working but javac -version was not. There are three things I did:
(1) I downloaded the latest jdk (not the jre) and installed it. Then, I added the jdk/bin path tan o environment variable. In my case, it was C:\Program Files\Java\jdk-10\bin. I did not need to add the ; for Windows 10.
(2) Move this path to the top of all the other paths.
(3) Delete any other Java paths that might exist.
Test the java -version and javac -version commands again. Voila!
For some reason it worked for me to add quotation marks to the path folder on windows 10. not C:\Program Files\Java\jdk 1.8.0_111\bin, but "C:\Program Files\Java\jdk 1.8.0_111\bin".
now i got it finally! make sure that there are no spaces before and after the path and put the semi-colon on both sides without spaces
The PATH is for current user, instead you can add a CLASSPATH and below link would help you more PATH and CLASSPATH
I added below Path in environment variable
C:\Program Files\Java\jdk1.8.0_91\bin
and then compiled the program but got the error then I restarted the system and again compiled the program
This time it worked :)
Add java path to environment variables and move it to the top of all the paths available there. It worked for me.
To be sure about your path, you can use double quotes " to locate the path or if you are in Windows, you can browse to path to select "C:\Program Files\Java\jdk1.8.0_121\bin" folder.
in the search window type 'environment variables' this should give you a link to editing the variables. On the variables editing page there is an upper section and a lower section in the lower section add NEW,type path C:\Program Files\Java\jdk-10\bin this worked great for me and it finds the compiler all the time.
Kind of beating a dead horse now but, I want to clarify one thing that may not be quite so obvious. Yes indeed you need to edit the PATH environment variable as already stated many times. The key for me was to edit the PATH under SYSTEM variables. I had inadvertently edited the PATH under USER variables. Why did this matter? On my machine I have to log in as an Administrator to edit environment variables. So editing the User variables was not helping because I run the command prompt under my login (non-admin) account. Grrr!
Also, I found that closing the command prompt window, and re-opening it after the PATH variable update was required. Changing the order of the values, adding semi-colons, etc. didn't make a difference for me.
Cheers
If you have set all PATH variables correctly after installation, just restart it.
I had the same problem, I had also installed new Windows7 OS then I upgraded it to Win 10. Then i started setup necessary tools like IntelliJ, Java jdk,jre, eclipse so on.
In cmd, java -version worked but javac compiler got unrecognized. I checked and all good, the files in the folders, path are correct and so on.
I restarted and checked it again in cmd ,it worked.
what I did is:
I typed ; accidentally in front in the path variable and then hit OK, after this if I again edit it was nowhere going to the same page as earlier, it opened a new page as defined for user variables and then I was able to remove double quotes in front of the PATH VARIABLE.
Everything worked fine then. :)
Did it just now.
Add
PATH = C:\Program Files\Java\jdk1.8.0_66\bin
in Advanced system setting. Then Choose Environment Variable.
for windows 10 Users Use Java path( JDK Bin location) AS "C:\Program Files\Java\jdk-9.0.1\bin" it will work.
Points to remember, do as the image shows. Move the highlighted bar up using move up button, this will help.
After years of working OK, I'm suddenly getting this message when trying to start the JVM:
Error: could not open `C:\Program Files\Java\jre6\lib\amd64\jvm.cfg'
I tried uninstalling, and got a message saying a DLL was missing (unspecified)
Tried re-installing, all to no avail.
At the same time, when trying to start Scala I get:
\Java\jdk1.6.0_25\bin\java.exe was unexpected at this time.
Checked %JAVA_HOME% and %path% - both OK
Can anyone help?
I checked my environment variables - JAVA_HOME & PATH and they all refer to C:\java. So this was bit frustrating. After sometime I found that the default installation also copied java.exe, javaw.exe and javaws.exe to C:\Windows\System32 (i.e. uninstall of JRE didn't go well). I just removed them and voila, I'm back on track. That annoying error is no longer popping.
This works for me
So, If exists, remove java.exe, javaw.exe and javaws.exe from System32
put %JAVA_HOME%\bin at the begin of PATH.
Might be a slightly different cause, but that second issue occurs for me in scala 2.9.0.1 on Win7 (x64), though scala-2.9.1.final has already resolved this issue mentioned here:
\Java\jdk1.6.0_25\bin\java.exe was unexpected at this time.
My %JAVA_HOME% set to a path like this: c:\program files(x86)\Java\jdk...
Note the space and the parentheses.
If you change line 24 in %SCALA_HOME%\bin\scala.bat from:
if exist "%JAVA_HOME%\bin\java.exe" set _JAVACMD=%JAVA_HOME%\bin\java.exe
to
if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
It works fine. Note the quotes around the set command parameters, this will properly enclose any spaces and 'special' characters (eg: spaces and parentheses) in the variable's value.
Hope this helps someone else searching for an answer.
I had a slight different solution to this problem. my PATH and JAVA_HOME were pointing to JDK12 in
C:\Program Files\Java
but execution of the command:
Java -version
gave the error:
Error: could not open `C:\ProgramFiles\Java\jre1.8.0_212\lib\amd64\jvm.cfg'
I had to delete a folder of executables (Java.exe, javaw.exe etc.) in a different directory than System32, as other answers here and blog posts have suggested. Instead I found the problem lied with executables found in:
C:\Program Files\Common Files\Oracle
as there was nothing Java related in
C:\Windows\System32
If you're having this issue and nothing is in System32, check this "common files" directory mentioned above for an oracle directory and delete it.
After, your PATH references should work fine!
I had the same problem: I have a 64 bit Windows and when I typed "java -version" in CMD-Console i received the same Error message.
Try to start a 64bit-cmd(C:\Windows\SysWOW64\cmd.exe) and you will see, it works there ;)
C:\ProgramData\Oracle\Java\javapath
I took a back up of the files in it and removed those files from there. Then I opened a new cmd prompt and it works like a charm.
If this was working before, it means the PATH isn't correct anymore.
That can happen when the PATH becomes too long and gets truncated.
All posts (like this one) suggest updating the PATH, which you can test first in a separate DOS session, by setting a minimal path and see if java works again there.
Finally the OP Highland Mark concludes:
Finally fixed by uninstalling java, removing all references to it from the registry, and then re-installing.
scary ;)
I thought I will share how I resolved the same issue "Error Could not open lib\amd64\jvm.cfg". I found the Java run time Jre7 is missing amd64 folder under lib. However, I have 1.7.0_25 JDK which is having jre folder and also having amd64.
I moved the original contents of jre7 folder to a backup file and copied everything from 1.7.0_25\jre.
Now I am not getting this error anymore and able to proceed with scene builder.
The Java 7 install on my work PC broke after a patch was forced out to us, giving this error any time you tried to run a Java program. Somehow the entire 'lib' subdirectory of the Java 7 install vanished! Might have been related to having both Java 6 and Java 7 installed -- the 'jre6' directory still had everything there.
In any case, I fixed it by uninstalling both Java 6 and Java 7 and reinstalling just Java 7. But if the file it's complaining about is actually there, then you're likely having a path issue as described in some of the other answers here.
Had suddenly the same Problem, from one day to another eclipse said
Failed to load the JNI shared library "C:/JDK/bin/client/jvm.dll"`.
after trying to run java on the console
Error: could not open `C:\WINDOWS\jre\lib\amd64\jvm.cfg'
now i just deleted the whole directory
C:\WINDOWS\jre
and everything worked again... i don't know there this jre came from, i hope it was not a virus
Another workaround is using shortpath in windows:
open windows command console using cmd.exe
goto c:\
type command> dir program* /x
it should display as short path like: PROGRA~2
so C:\PROGRA~2 is same as C:\Program Files (x86)
in your JAVA_HOME replace path to :
C:\PROGRA~2\Java\jre7
This should work in windows 64 environment as it worked for me in win7 64bit version.
I have changed the java installation path from c:\Program Files (x86)\java to another folder like c:\java\jdk1.7 and updated the %Java_HOME% and path values accordingly,it worked.
example
%JAVA_HOME% = C:\java\JDK1.7
path-C:\java\JDK1.7\bin;
I had the same problem in Eclipse and I fixed it by changing the JRE from 64 bit to 32 bit:
Window > Preferences > Java > Installed JREs > Add... > Next > Directory > select "C:\Program Files (x86)\Java\jre1.8.0_65" instead of "C:\Program Files\Java\jre1.8.0_60"
I had a similar problem (trying to start a Jenkins slave agent on Windows) on Windows 2008R2, Java 1.7.0_15
I had two situations that contributed to the problem and that changing both of them fixed it:
1) Installing Java in a unix-compatible path (changing from c:\Program Files\... to c:\Software\...); I don't think this directly affected the problem described in this thread, but noting the change;
2) Running Java not through a shortcut. It originally failed with a shortcut, but re-running from the direct executable (C:\Software\Java...\bin\java) worked.
Reinstalling java didn't help me. But the trick to put the JAVA_HOME variable at the beginning of the env-vars. The problem occoured after an upgrade from jdk1.7.0_11 to jdk1.7.0_13
I had this problem after updating your java. The best way to solve this problem is just go to your c:/ProgramFiles/Java folder. There you will find two jre folders one is as jre.your version and other with exactly like jdk folder. Try to remove jre.1.your version folder. There you go your problem is solved. Hope this might help. It's worked for me.
Typically it because of upgrading JRE.
It changes symlinks into C:\ProgramData\Oracle\Java\javapath\
Intall JDK - it will fix this.
Error: could not open `C:\Program Files\Java\jre6\lib\amd64\jvm.cfg'
Looking # it the issue of post install script is there and getting propagated since I am using update jdk8 1.8.0_191 since issue occurred with me after installing update of java and which was happened automatically.
Error: could not open `C:\Program Files\Java\jre1.8.0_191\lib\amd64\jvm.cfg'
This will be never ending in this case and need to do workaround like changing path's manually.
Delete the jars under system32 for windows.
Delete the jars under C:\Program Files\Common Files\Oracle
Edit the environment variable set JAVA_HOME and SET PATH to bin
I have solved this issue by deleting the Oracle folder from Program Data. And also delete the oracle java path associated with that folder from environment variables.
I kept variable name as "Path" but it did not work after changing it to "PATH"
started working for me.
variable name: PATH
variable value: C:\Program Files\Java\jdk-19\bin
this will work.
It wasn't in the path. Finally fixed by uninstalling java, removing all references to it from the registry, and then re-installing. None the wiser, but back working again. Thanks all #Highland Mark- Can you tell me the process to removing references from registry. I tried all possible way people mentioned here, nothing worked.
If you have downloaded several Jdks you have to delete all except of the JDK you want to use!
javac is not internal or external command error is coming. I have set the path. then also it is giving the same error.
Are you sure you installed the JDK?
The JRE (aka "Java Runtime") does not contain javac, this is only part of the JDK ("Development Kit")
You should first examine the PATH by executing this command:
echo %PATH%
Among these folders should be at least one that looks similar to this:
C:\Program Files\Java\jdk1.6.0_20\bin
Maybe you left out the bin at the end, maybe there isn't such a folder name at all in your PATH? We cannot know. If you tried this and are still unsure, post the value of the PATH so we can give you real tips instead of just guessing.
If you're on windows, and running from a command prompt you need to reopen it to force any PATH changes to take effect