Home » Default » Linux 安装 JAVA jdk-11.0.1

下载:jdk-11.0.2_linux-x64_bin.tar.gz
https://www.oracle.com/java/technologies/javase/jdk11-archive-downloads.html
1、新建java文件夹:

mkdir /usr/java

2、解压到/usr/java

tar -zxvf jdk-11.0.2_linux-x64_bin.tar.gz

3、编辑profile:

vim /etc/profile

4、在最后加入:

export JAVA_HOME=/usr/java
export CLASSPATH=.:${JAVA_HOME}/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin

5、执行生效:

source /etc/profile

6、验证安装:

[root@localhost]# java -version
java version "11.0.2" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+7-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+7-LTS, mixed mode)

PS:jdk生成对应的jre

jlink --module-path jmods --add-modules java.base --output jre

标签: Linux Java jdk-11.0.1

添加新评论

V