1 官网下载 

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

linux安装jdk_bash

2 上传到linux里面  

使用xshell工具  首先安装上传下载工具

yum -y install lrzsz 

linux安装jdk_vim_02

 

 cd /usr/local/src/ 

拖动文件到该目录

3 解压 

tar -zxvf jdk-8u161-linux-x64.tar.gz

4 移动

mv /usr/local/src/jdk1.8.0_161/ /usr/local/jdk1.8

cp /etc/profile /etc/profilebak

 

5 vim /etc/profile 最后添加  vim /etc/profile.d/java.sh

export JAVA_HOME=/usr/local/jdk1.8
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

  

 

6 source /etc/profile

 7 查看效果

linux安装jdk_linux_03

 

报错 

 

[root@localhost jdk1.8]# java -version
-bash: /usr/local/jdk1.8/bin/java: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
[root@localhost jdk1.8]# java -version
-bash: /usr/local/jdk1.8/bin/java: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
[root@localhost jdk1.8]# 

 

解决  

sudo yum install glibc.i686