10
4
I have done the following:
1. Set the environment variable JAVA_HOME:
2. Add Java 1.6.0_45 and disable Java 1.8.0_66 in Java Runtime Environment Settings under Configure Java:
Unfortunately, the Java is still 1.8.0_66:
>java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b18, mixed mode)
Could anyone offer a tip on this?
Edit:
Per David's suggestion, the following is the Java related contents from the output of command PATH (the entire output is super long, I hope the following is sufficient for this question.):
PATH=C:\ProgramData\Oracle\Java\javapath; ... C:\Program Files\Java\jdk1.6.0_45\bin
1Please [edit] and include the output of
path
in acmd
shell. – DavidPostill – 2016-03-26T11:23:28.023@DavidPostill I have just done it following your suggestion. Thank you. – Hong – 2016-03-26T11:37:59.060
1
C:\ProgramData\Oracle\Java\javapath
will be1.8.0_66
. PutC:\Program Files\Java\jdk1.6.0_45\bin
first. – DavidPostill – 2016-03-26T11:39:35.133Note that changes to environment variables may not be fully applied until you sign in again. Reboot and try
java -version
again. – gronostaj – 2016-03-26T11:41:08.613@DavidPostill I noticed that after checking the path per your suggestion. Windows 10 does not allow me to edit the path because it says "This environment variable is too large." I know there should be another question to deal with this separately. – Hong – 2016-03-26T11:45:50.240
1Have you tried to put just ´%JAVA_HOME%\bin´ instead ´C:\Program Files\Java\jdk1.6.0_45\bin´ – Stackcraft_noob – 2016-03-26T11:45:59.250
@Hong "This environment variable is too large" - you need to clean up your path. My guess is you have a lot of dupe entries. – DavidPostill – 2016-03-26T12:01:00.580
@DavidPostill I managed to delete "C:\ProgramData\Oracle\Java\javapath" and put "%JAVA_HOME%\bin" first. Now Java -version returns "1.6.0_45". The PATH command returns "C:\Program Files\Java\jdk1.6.0_45\bin;" as the first. Could you turn your comment to an Answer so that I can accept and close this question? – Hong – 2016-03-26T12:43:55.633
@Stackcraft_noob ´C:\Program Files\Java\jdk1.6.0_45\bin´ was actually the result of ´%JAVA_HOME%\bin´ that I added to the user (not system) variable PATH. Now I have moved it to the system PATH. – Hong – 2016-03-26T12:46:42.803
@gronostaj I have noticed that I need to restart CMD, not the computer, after changing the environment. – Hong – 2016-03-26T13:10:46.500
@Stackcraft_noob thanks for the tip, for me, the windows didn't want to recognize the ´C:\Program Files\Java\jdk1.6.0_45\bin´, but did accept ´%JAVA_HOME%\bin´ – CsBalazsHungary – 2017-02-24T13:36:37.733
I would remove javapath from PATH and add the actual java version directory directly. This allows easy switching without the need to maintain the registry. Note that this is not true for in-Browser Java. – eckes – 2017-05-27T18:45:28.340