Java.exe always points to a JRE path, but not a JDK

I have both jdk and jre installed on my windows 7.

I set JAVA_HOME to

C:\Program Files\Java\jdk1.6.0_23 

I have

 C:\Program Files\Java\jdk1.6.0_23\bin 

in PATH.

but java.exe still points to my jre dir, which

 C:\Program Files\Java\jre6\bin 

since at startup

 java.exe -server 

he complains

 Error: no `server' JVM at `C:\Program Files\Java\jre6\bin\server\jvm.dll'. 

can someone tell me what else do i need to install?

+8
java environment-variables
Mar 09 2018-11-11T00:
source share
5 answers

since you are on windows, java does not work like that. there is java.exe in the windows directory (% windir% system32 for you)

This java.exe really looks in the registry HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment

WAY will not help! Since I'm lazy, I remove the JRE and create a junction for the JDK.

+13
Mar 09 '11 at 19:12
source share

Just remove java.exe from% windir% \ system32

+3
Mar 16 '11 at 15:50
source share

Right-click My Computer> Properties> Advanced System Settings> Environment Variables>

Finding the way ..

Delete the existing path, and then add your own.

take care of half-colony

0
Mar 09 '11 at 19:03
source share

make sure your jre / bin directory is not included in your path. the first java.exe instance found when looking for your path will be the one that is executing. if you added the JDK to the path after the JRE, then the JRE will always be selected.

you can also explicitly specify the full path to java.exe when calling java. this ensures that you always know that you are using java jre / jdk.

0
Mar 09 '11 at 19:05
source share

If you have a 64-bit operating system, it will try to use the 64-bit jre, which is pre-installed on Windows 7. You can try adding / removing programs to remove the 64-bit jre. I had this problem several times and I always fixed it by deleting the 64 bit bit.

0
Mar 09 '11 at 19:07
source share



All Articles