3

Before marking it duplicate FYI I have already read How can I change the Java Runtime Version on Windows (7)? and How to set path for Jre 6 when jre 7 installed?.

I have both Java7 and Java8 in my machine. I have

JAVA_HOME = C:\Program Files\Java\jdk1.7.0_60
PATH = ...;%JAVA_HOME%\bin;....

but I am getting

C:\>java -version
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

C:\>javac -version
javac 1.7.0_60

I want to set JRE to 1.7 too. How to do that?

1
  • JRE 1.8 must be somewhere on the PATH before JDK 1.7. Type echo %PATH% and look through directories that are there Commented Apr 20, 2015 at 16:46

5 Answers 5

3

You will probably have to edit your path environment variable.

If you want to check what's in your PATH environment variable in an organized fashion, run:

echo %path:;=&echo.%

Make sure the 1.8 is not on the path or if you want it there make sure it appears after 1.7.

To edit it, go to My Computer > Properties > System Properties > Advanced tab > Advanced section > Environment Variables.

Also check what is actually launched when you run java from the command line, run the following command:

where java

It will show you what windows runs when you request java.

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

3 Comments

1.8 is not in path at all. PATH has entry for 1.7 only.
Ahaa - I see there is an shortcut entry C:\ProgramData\Oracle\Java\javapath\java.exe pointing to 8. Does anyone know what this entry in path for? If not important I am planning to delete this entry or move to the end.
I'd rename it first to java.exe.bak, an see if it breaks anything.
0

To solve the problem, remove or change the name of java.exe and javaw.exe into System32 folder:

Like this screenshot

Comments

0

Prepend the System Variable's Path with JRE bin's path.

Comments

0

where java did work for me. I found there is another version of java associated with the SPSS (1.8.0). Uninstall SPSS and the problem solved.

Comments

0

The solution that worked for me was: In "Path" variable replace "C:\ProgramData\Oracle\Java\javapath;" with %JAVA_HOME%\bin where JAVA_HOME variable was set to "C:\Program Files\Java\jdk1.7.0_60"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.