Install

文档

Linux

目录结构

/
├── opt
│   ├── install
│   │   └── java
│   │       └── null
│   └── package
│       └── java
│           ├── jdk-8u301-linux-x64
│           └── jdk-8u301-linux-x64.tar.gz
├── root(me)
└── usr
1
2
3
4
5
6
7
8
9
10
11

源码安装

参考

安装

# 新建目录,拷贝解压java:
mkdir -p /opt/{install/java,package/java}
cd /opt/package/java
wget https://download.oracle.com/otn/java/jdk/8u301-b09/d3c52aa6bfa54d3ca74e617f18309292/jdk-8u301-linux-x64.tar.gz
# wget https://download.java.net/openjdk/jdk8u41/ri/openjdk-8u41-b04-linux-x64-14_jan_2020.tar.gz
# wget https://builds.openlogic.com/downloadJDK/openlogic-openjdk/8u262-b10/openlogic-openjdk-8u262-b10-linux-x64.tar.gz
tar -zxvf jdk-8u301-linux-x64.tar.gz

# 安装
vi /etc/profile
#Java
export JAVA_HOME=/opt/package/java/jdk1.8.0_301
export CLASSPATH=.:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin

# 让修改生效:. 或者 source
. /etc/profile
source /etc/profile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

检查

java -version
1

YUM安装

参考:

# 查找
yum list java*
# 安装
yum install java-1.8.0-openjdk.x86_64
# 检查
java -version
1
2
3
4
5
6
总字数: 183 字  上次更新: 2023-03-14 00:25:11