Unable to change Java Version in windows

Issue

Previously I am using Java 1.8 in my machine. But now i need to use Java 1.6. So I changed the below values in system environment variables.

JAVA_HOME

U:\POC\jdk1.6.0_31

PATH

U:\POC\jdk1.6.0_31\bin\ or %JAVA_HOME%/bin

Also I restarted my system

Even after that it is displaying java version as 1.8 in my command prompt.

command Prompt

Can anyone advice on how to resolve this issue?

Solution

I’ve not used Windows in a long time but I remember that there are 2 sections of environment variables. One system scope, and the other user scope.

  1. Check that nothing in the system scope is defining a JAVA_HOME.
  2. Like @Stephen C said, post the output of echo %PATH% and echo %JAVA_HOME%.
  3. Check that nothing comes before %JAVA_HOME%/bin in the path that may contain the java executable. Things like Oracle client come with Java. You can always put %JAVA_HOME%/bin in front of the path instead of at the end.

@David Santiago’s answer is a bad idea. If you let the IDE do your job, you won’t be able to troubleshoot when there is a problem.

Answered By – Abhijit Sarkar

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published