This is a note about configuring Java on Windows that is mostly for reference later. Usually when I set Java up on a Windows machine, one of the first things I need to do manually is make sure that JAVA_HOME
is set and that the PATH
variable contains the folder with the Java executables. The variable on PATH
is typically a “bin” folder, whereas the JAVA_HOME
variable is up one from that, or up a few more directory levels if it’s a JDK.
Recent versions of Java on Windows have changed the way that Java is installed. Now it creates a C:\ProgramData\Oracle\Java\javapath
folder that is added to the PATH
, then this folder contains symlinks to for each of java.exe
, javaw.exe
, and javaws.exe
(the main Java executables) over to wherever they are installed on the file system (typically in C:\Program Files
or perhaps C:\Java
). This is a nice idea so that people are constantly fiddling with their PATH
to configure it to a specific versioned Java install (complete with major, minor, and build numbers).
Yes, Windows supports symlinks. While more commonly seen or known in Linux filesystems, Windows’ NTFS filesystem has had support for file links for quite some time. They’re just not used a whole lot by end users themselves.
In any case, unfortunately, this install/configuration process doesn’t always seem to work in terms of creating/updating the symlinks. But they can be fixed pretty easily. Just navigate to the javapath
subfolder:
Then run these three commands, altered of course to match up with your actual version of Java:
mklink java.exe "C:\Program Files\Java\jdk1.8.0_102\bin\java.exe" mklink javaw.exe "C:\Program Files\Java\jdk1.8.0_102\bin\javaw.exe" mklink javaws.exe "C:\Program Files\Java\jdk1.8.0_102\bin\javaws.exe"