0

I have CentOS 6.7. I installed OpenJDK 1.8 with the following command.

yum install java-1.8.0-openjdk-devel

After installing I executed the following two commands.

export JAVA_HOME=/usr/jdk/jdk1.8.0_121
export PATH=$JAVA_HOME/bin:$PATH

But when I type java -version I still see the following output. I do not see OpenJDK.

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)

EDIT

I have posted a similar thread, regarding not finding 'javac' in the thread -bash: javac: command not found” error after installing OpenJDK 1.7 In that thread I was not able to execute javac which was resolved and it was about OpenJDK 1.7 (not 1.8). But this thread is all about java -version not showing OpenJDK for OpenJDK 1.8.

  • 1
    You appeared to have installed the "devel" package, which looks to me like it installs .../bin/java to a subdirectory of /usr/lib/jvm/, not /usr/jdk/ – Jeff Schaller Apr 6 '17 at 12:33
  • Possible duplicate of Bash remembers wrong path to an executable that was moved/deleted – G-Man Apr 7 '17 at 3:56
  • One strange thing I have observed it that, after I removed OpenSDK 1.8 by executing yum remove command, I still see the same output for java -version command. If I execute the command yum list installed | grep java* I do not see OpenSDK 1.8 package. So I am now really confused. – KurioZ7 Apr 7 '17 at 4:07
  • Use type java in bash to find out what you're actually running, and if it's a link follow to its (final) target, then do rpm -qf on that file. Also: Java is OpenJDK, not OpenSDK, which is several somethings completely different. @JeffSchaller: similarly java-1.8.0-openjdk-headless, which is JRE-minus-AWT, installs to /usr/lib/jvm/fullversion/jre, not /usr/jdk. And the CentOS 6 repositories I use (AFAIR default) don't (now?) have any java-ver-oracle/sun versions at all. – dave_thompson_085 Apr 7 '17 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.