I\'m in the situation where I\'ve installed the JDK, but I can\'t run applets in browsers (I may not have installed the JRE).
However, when I install the JRE, it clo
I just had that problem (Java 1.8 vs. Java 9 on Windows 7) and my findings are:
short version
default seems to be (because of Path entry)
c:\ProgramData\Oracle\Java\javapath\java -version
select the version you want (test, use tab completing in cmd, not sure what those numbers represent), I had 2 options, see longer version for details
c:\ProgramData\Oracle\Java\javapath_target_[tab]
remove junction/link and link to your version (the one ending with 181743567 in my case for Java 8)
rmdir javapath
mklink /D javapath javapath_target_181743567
longer version:
Reinstall Java 1.8 after Java 9 didn't work. The sequence of installations was jdk1.8.0_74, jdk-9.0.4 and attempt to make Java 8 default with jdk1.8.0_162...
After jdk1.8.0_162 installation I still have
java -version
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
What I see in path is
Path=...;C:\ProgramData\Oracle\Java\javapath;...
So I checked what is that and I found it is a junction (link)
c:\ProgramData\Oracle\Java>dir
Volume in drive C is OSDisk
Volume Serial Number is DA2F-C2CC
Directory of c:\ProgramData\Oracle\Java
2018-02-07 17:06 .
2018-02-07 17:06 ..
2018-02-08 17:08 .oracle_jre_usage
2017-08-22 11:04 installcache
2018-02-08 17:08 installcache_x64
2018-02-07 17:06 javapath [C:\ProgramData\Oracle\Java\javapath_target_185258831]
2018-02-07 17:06 javapath_target_181743567
2018-02-07 17:06 javapath_target_185258831
Those hashes doesn't ring a bell, but when I checked
c:\ProgramData\Oracle\Java\javapath_target_181743567>.\java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
c:\ProgramData\Oracle\Java\javapath_target_185258831>.\java -version
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
so to make Java 8 default again I had to delete the link as described here
rmdir javapath
and recreate with Java I wanted
mklink /D javapath javapath_target_181743567
tested:
c:\ProgramData\Oracle\Java>java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
** update (Java 10) **
With Java 10 it is similar, only javapath is in c:\Program Files (x86)\Common Files\Oracle\Java\ which is strange as I installed 64-bit IMHO
.\java -version
java version "10.0.2" 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)