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']
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.