Centos6.5安装JDK环境

时间:2024-09-04 10:36:56

1,系统版本查看

Centos6.5安装JDK环境

2,下载jdk1.8

wget http://download.oracle.com/otn-pub/java/jdk/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-i586.tar.gz?AuthParam=1505986442_8c0fe3d7c43529867d7ea07ee729829b

3,在/usr/目录下创建java目录

mkdir/usr/java

把下载的jdk放在这个目录然后解压

tar -xf jdk-8u144-linux-i586.tar.gz

4,配置环境变量

vim /etc/profile

在结尾添加

export JAVA_HOME=/usr/local/java/jdk1.8.0_144
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

设置生效 source /etc/profile

查看

java -version

PS:openjdk的查看 yum search openjdk

openjdk的安装 yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel