I've two JDK's on my CentOS machine, 1.7 and 1.8.
When I set my JAVA_HOME
to 1.7 the java -version
command still shows 1.8
What's this? And how to fix?
centoscentos6centos7java
I've two JDK's on my CentOS machine, 1.7 and 1.8.
When I set my JAVA_HOME
to 1.7 the java -version
command still shows 1.8
What's this? And how to fix?
Best Answer
It depends on how you run
java
. If you runjava -version
without specifying any path, the firstjava
executable found in$PATH
environment variable is used. This has nothing to do withJAVA_HOME
var.If you want to change the java executable you are using based on changing the
JAVA_HOME
var, you can run it: