BigData-Notes/notes/installation/Linux下JDK安装.md
2020-06-01 14:35:36 +08:00

58 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Linux下JDK的安装
>**系统环境**centos 7.6
>
>**JDK 版本**jdk 1.8.0_20
### 1. 下载并解压
在[官网](https://www.oracle.com/technetwork/java/javase/downloads/index.html) 下载所需版本的 JDK这里我下载的版本为[JDK 1.8](https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) ,下载后进行解压:
```shell
[root@ java]# tar -zxvf jdk-8u201-linux-x64.tar.gz
```
### 2. 设置环境变量
```shell
[root@ java]# vi /etc/profile
```
添加如下配置:
```shell
export JAVA_HOME=/usr/java/jdk1.8.0_201
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
```
执行 `source` 命令,使得配置立即生效:
```shell
[root@ java]# source /etc/profile
```
### 3. 检查是否安装成功
```shell
[root@ java]# java -version
```
显示出对应的版本信息则代表安装成功。
```shell
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
```
<div align="center"> <img src="https://gitee.com/heibaiying/BigData-Notes/raw/master/pictures/weixin-desc.png"/> </div>