linux 安装jdk-8u181-linux-x64

1,下载安装包

官网下载地址:https://www.oracle.com/technetwork/java/javase/downloads/index.html

2,新建jdk安装路径 

mkdir /usr/local/java

3 ,然后把安装包上传到/usr/local/java目录下

4,进入java目录,解压安装包

cd /usr/local/java

tar -xvf jdk-8u181-linux-x64.tar.gz

5,解压后对jdk文件进行授权

chmod +x /usr/local/java/jdk1.8.0_181/bin/java

chmod +x /usr/local/java/jdk1.8.0_181/bin/javac

chmod +x /usr/local/java/jdk1.8.0_181/jre/bin/java

6,配置java环境变量

vim /etc/profile

      在文件末尾添加:

JAVA_HOME=/usr/local/java/jdk1.8.0_181

JRE_HOME=/usr/local/java/jdk1.8.0_181/jre

CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib

PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin

export JAVA_HOME JRE_HOME CLASS_PATH PATH

7,使配置生效

source /etc/profile

8,检查是否安装成功

java -version

      成功显示如下:

java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

 

你可能感兴趣的:(linux)