Reputation: 422
I'm curious about the difference that exists between the paths that I see in the windows environment to java.
If I do a command where java
I can see
C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe
C:\ProgramData\Oracle\Java\javapath\java.exe
C:\Program Files\Java\jdk1.6.0_21\bin\java.exe
And I have seen that the first one, the javapath, gets updated with the latest java sdk I have installed. However, most of what you google tells you should set the environment variable PATH to the latest, the one with the jdk in the path. So what is the best, how do they work. For example, what's best for Xamarin or Android development?
Hopefully someone has some insight, I'd appreciate comments on this. Now I know, (everyone does) that to change the path to java you have to set the JAVA_HOME variable. I did this after posting this, it's hard to recall everything you read at any given moment! Still what's the purpose of the other paths, and why does updating java jre automatically sets the java version while downloading an sdk requires a manual update?
Upvotes: 13
Views: 26132
Reputation: 143
I just moved %JAVA_HOME%\bin
to before the C:\Program Files (x86)\Common Files\Oracle\Java\javapath
and it works without any problem. I suggest you to check your environment variables and your Path variable regularly, especially after you install something on your machine.
Upvotes: 0
Reputation: 2850
When a new version of JRE is installed, this path C:\Program Files (x86)\Common Files\Oracle\Java
appears to be updated with executables corresponding to the new JRE version. The problem is this would be JRE and not JDK. So, programs that depend on JDK (IDE for example) will fail to launch.
Here is how I get it to work consistently
JAVA_HOME
pointing to the JDK Home. And add %JAVA_HOME%\bin
to the PATH
environment variable.C:\Program Files (x86)\Common Files\Oracle\Java\javapath
from the Path
environment variable in System Environment Variables (Control Panel -> System -> Advanced System Settings -> Environment Variables -> System Variables).This works as of Aug 2020 for Windows 10 (1903), Java 8u251. :)
Upvotes: 20
Reputation: 351
On my machine, the files in C:\ProgramData\Oracle\Java\javapath used to symlink to files elsewhere. But noticed this has changed in or before 8u112. Worth noting that on my current release (8u171) both javapath folders symlink to "target" folders in the same directory.
If I undo the things in c:\programdata I notice that my Eclipse environment stops working well.
But I don't have much more insight on the history or why behind all of this though.
Upvotes: 2