liunx 安装jdk
1 下载jdk
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2 切换root 用户,在usr建立java 目录
cd /usr
mkdir java
3 把jdk-8u171-linux-x64.tar.gz压缩包 复制到/usr/java/ 目录下,命令略
4 解压到当前目录 ,得到jdk1.8.0_171
tar -zxvf jdk-8u171-linux-x64.tar.gz
5 设置配置环境
vi /etc/profile
添加如下内容:JAVA_HOME根据实际目录来
export JAVA_HOME=/usr/java/jdk1.8.0_60 export CLASSPATH=$JAVA_HOME/lib/ export PATH=$PATH:$JAVA_HOME/bin export PATH JAVA_HOME CLASSPATH
6 配置生效
source /etc/profile
7 检查是否成功
java -version
成功是这样
java version "1.8.0_171" Java(TM) SE Runtime Environment (build 1.8.0_171-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)