A Java-based application on my Windows 10 machine recently started prompting me to upgrade my version of Java. Since I wanted to control it myself, I declined the app's offer to upgrade for me, and downloaded and installed the latest Java 8 from Oracle. In my case, Java 1.8.0_171, 64-bit version.
The upgrade went fine. But when I launched the app, it again said I needed to upgrade. Why was it still looking at the old location?
I made the change using Settings, to change the JAVA_HOME environment variable to point to the location of the new upgrade. But no change, the app still insisted that I needed to upgrade.
A little research into the app's execution path showed that it was using c:\ProgramData\Oracle\Java\javapath to find Java. When I looked in that folder, I found symbolic links to my old Java installation.
Normally, this hidden bit of information gets updated automatically in the upgrade or installation process. I have read of cases where, when downgrading to an older version, these symlinks do not get updates. See here and here.
But in my case it was an upgrade. Possibly it was the change from 32-bit to 64-bit Java.
Whatever the reason that these links were not changed, here is how to change them:
1. Launch a command-shell as Administrator;
2. Navigate to the folder c:\ProgramData\Oracle\Java\javapath
3. Remove the existing symbolic links with
del java*.exe
4. Recreate each of the links, pointing to your own Java installation.
mklink java.exe "C:\[your_install_path_here]\bin\java.exe"
mklink javaw.exe "C:\[your_install_path_here]\bin\javaw.exe"
mklink javaws.exe "C:\[your_install_path_here]\bin\javaws.exe"