I have installed multiple versions of Java on my Windows 10 system.
I am not sure how Java is set up. I see the following entry under environment variables
I see the following files in the directory above
Then there are the installations in the 'Program Files' directory
I had 1.8.0_202 on my system. Then I installed update 1.8.0_361. The system continues to be using update 202. What I need to do to make the system use update 361. Disabling update 202 does not to the job. Also, if you can explain how all these different entries (the environment variables, the files in the C:\Program Files (x86)\Common Files\Oracle\Java\javapath) are used.
CodePudding user response:
When you type java
at the command prompt, Windows will look for java.exe
in the directories specified by the PATH
environment variable, starting with the first one. In your case, that's C:\Program Files(x86)\Common Files\Oracle\Java\javapath
. That folder contains a few files which are nothing more than symbolic links to executables found in the latest installed JRE. In your case, that will be C:\Program Files\Java\jre1.8.0_361\bin
.
What seems to be happening is that the JRE gets automatically updated, and you've got the latest JRE installed. But the JDK is not automatically updated: you have to do that manually. You still have version 1.8.0_202 of the JDK. So when you type javac
(to compile a Java source file), you are using the JDK, and that's found in C:\Program Files\Java\jdk1.8.0_202\bin
which is the last directory specified in your PATH
environment variable.
You can clean up by removing the current versions of JRE and JDK and install the latest JDK.
CodePudding user response:
Do you use any IDE? If you are using eclipse then right-click on the project select build path then configure the build path there is an option JRE system library edit it and choose the latest java version.