4

I have set my environment variables up. Window 7 - 32 bit

C:\Users\user>java -version
Error: could not open `E:\lib\i386\jvm.cfg'

C:\Users\user>echo %JRE_HOME%
C:\Program Files\Java\jre7\bin

C:\Users\user>echo %PATH%
C:\Program Files\PC Connectivity Solution\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\jdk1.6.0_22/bin;C:\Program Files\Java\jre7\bin/bin;C:\Ruby193\bin;C:\Ruby187\bin

C:\Users\user>java -version
Error: could not open `E:\lib\i386\jvm.cfg'

I checked on E: there is nothing on the location. I have JRE7 and jdk1.6.0_22.

Could you please give me solution for this?

I tried to use this solution, Not able to properly set up the path of java in Windows 7 , 64 bit however, while clicking on JAVA present on control panel it is giving me same error message. [ Error: could not open `E:\lib\i386\jvm.cfg']

10
  • Probably, you have %JAVA_HOME% variable set Commented Feb 23, 2015 at 20:46
  • stackoverflow.com/questions/9051103/java-path-error-of-jvm-cfg Commented Feb 23, 2015 at 20:50
  • I have set JAVA_HOME too C:\Users\user>echo %JAVA_HOME% ---> C:\Program Files\jdk1.6.0_22 Commented Feb 23, 2015 at 20:50
  • Did you try Andermonly's comment? Commented Feb 23, 2015 at 20:53
  • Yes, I did! I reinstall JRE and checked that the jvm.cfg file is present in the specified location. All paths are correct! Still on opening new cmd prompt I am getting the same error. Commented Feb 23, 2015 at 20:56

4 Answers 4

5

When you install a JRE, the installer writes a special java.exe in the Windows system directory (ex . C:/winnt/system32/java.exe). This java.exe will look in the registry to get the location of the current JavaHome.

[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion]  (64 bits or 32 bits only)
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment\CurrentVersion] (32 bits installed on OS 64 bits)

and then get the path of the JRE for the version marked as current.

For a 32 bits JRE installed on a Windows 64 bits installation :

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment\CurrentVersion] -->  1.8

and then

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment\1.8\JavaHome] --> C:\Program Files (x86)\Java\jre1.8.0_31

So verify the values in the registry and clean up you PATH because you don't need it to launch java.exe from the command prompt by typing only java.exe.

If your setup is correct, you will be able to override the default JRE without modifying your PATH :

> java -version:"1.6" MyClass  (force the jre 1.6 installed to be used)

The JAVA_HOME and JRE_HOME environment variable are not used by the JRE installed in the "Program Files" with the installer, they are used by convention by IDE, tools or application server.

Sign up to request clarification or add additional context in comments.

1 Comment

Please note that the JRE -version: parameter is planned to be removed in JDK9, openjdk.java.net/jeps/231
0

Type

echo %PATH%

and check from which location your java.exe is invoked. Path could be overriden by old java installation.

Comments

0

Why do you have a JDK 1.6 and a JRE 7?

And your Java environment variables are set wrong. The jdk and jre paths have a backward slash before the bin, your jre has \bin\bin

edit I am referring to your path variable here

Please use either jdk 1.7 or jdk 1.6. That choice depends on development you are doing. The jdk contains a Jre so you do not need to download both.

Note that if you are not confident about manually setting the path, you can rely on the the installer that does all the required steps for you.

7 Comments

I have updated the path to "C:\Program Files\PC Connectivity Solution\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;%JAVA_HOME%/bin;%JRE_HOME%/bin;" still getting the same issue. Having jdk 1.6 and a Jre 7 is that a problem? should I update/uninstall any of that?
what are you using Java for? is it Java based development? or browsing or anything else?
in all cases, your path should contain only one Java. you can make jre_home point to the jdk 1.6 Jre folder.
please change the / to `\` in your path variable for both the Java paths
are you sure you have jdk 1.6 32 bit? and I really suggest Uninstall in and reinstalling Java to fix this solution stackoverflow.com/a/18664400/3396197
|
0

When Java is installed on Windows 7 using the installer download, a copy of java.exe is installed by default in C:\Windows\System32 and a link to java.exe is created in C:\ProgramData\Oracle\Java\javapath which is added to your Path environment variable.

When you run java -version it is useful to ask what java executable does that invoke and where is it located? Your issue may be simplified and possibly solved by renaming or removing conflicting Java executables from the System32 folder and from other locations in your personal Path and the system Path in which they may also be installed.

2 Comments

That is the problem..I checked the location its showing in cmd "Error: could not open `E:\lib\i386\jvm.cfg'" However, there is no lib folder or anything present in E driver. However, why is it showing that location is the mystery. What am I missing..
Try completely reinstalling Java preferably after removing all old installations in all locations and all Path components referencing them including those in your personal Path and the system Path.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.