I have CentOS 6.7. I have installed Java 1.8. When I do Java -version I see the following output.
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
I need javac so I came to know that this is available only if I install JDK. So I installed JDK by executing the following command
yum install java-1.7.0-openjdk-devel
The installation was successful. But now when I again execute the command java -version, I see the old result. If I try to execute javac at the command prompt I see the error '-bash: javac: command not found'. I observed that OpenJDK was installed to the directory /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.131.x86_64/bin. So, I set it to JAVA_HOME, but I still cannot execute javac command. What am I doing wrong here?
JAVA_HOME
is necessary for running Java, executables are still searched in$PATH
, not in$JAVA_HOME/bin
.