centos install java

yum update

search for if any older JDK versions are installed in your system.

rpm -qa | grep -E '^open[jre|jdk]|j[re|dk]'

Sample output:

gobject-introspection-1.36.0-4.el7.x86_64pygobject3-base-3.8.2-4.el7.x86_64

To check the already installed Java version, enter the following command:

java -version

If Java 1.6 or 1.7 have been installed already, you can uninstall them using the following commands.

yum remove java-1.6.0-openjdkyum remove java-1.7.0-openjdk

Download And Install Oracle Java JDK
As I use 64bit CentOS 7 server, I have downloaded the 64bit rpm package.
Then, go to the directory where you’ve downloaded the jdk package, and run the following command to install it.

rpm -ivh jdk-8u25-linux-x64.rpm

Check Java version

java -version

Sample output:

java version "1.8.0_25"Java(TM) SE Runtime Environment (build 1.8.0_25-b17)Java
 HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

set configuration

export JAVA_HOME=/usr/java/jdk1.8.0_25/
export PATH=$PATH:$JAVA_HOME

at the end

source /efc/profile
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容