在debian9.3下面安装与设置Oracle jdk1.8的最好方法

1、ssh  login到debian9 系统

2、切换到rott用户:sudo su-  OR  su –

3、下载oracle jdk1.8

###32 bit ###

# wget –no-check-certificate –no-cookies –header “Cookie: oraclelicense=accept-securebackup-cookie” http://download.oracle.com/otn-pub/java/jdk/8u152-b16/aa0333dd3019491ca4f6ddbe78cdb6d0/jdk-8u152-linux-i586.tar.gz

### 64 Bit ###

# wget –no-check-certificate –no-cookies –header “Cookie: oraclelicense=accept-securebackup-cookie” http://download.oracle.com/otn-pub/java/jdk/8u152-b16/aa0333dd3019491ca4f6ddbe78cdb6d0/jdk-8u152-linux-x64.tar.gz

4、解压jdk.tar.gz  文件并移到/usr/local/目录:

#tar -zxvf jdk-8u*-linux-*.tar.gz

#  mv jdk1.8.*/ /usr/local/

5、安装oracle jdk1.8

# update-alternatives –install /usr/bin/java java /usr/local/jdk1.8.*/bin/java 2

# update-alternatives –config java

6、选择那oracle jdk1.8

There are 2 choices for the alternative java (providing /usr/bin/java).

Selection    Path                                            Priority   Status

————————————————————

* 0            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      auto mode

1            /usr/local/jdk1.8.0_152/bin/java                       2         manual mode

2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

 

Press  to keep the current choice[*], or type selection number: 1

update-alternatives: using /usr/local/jdk1.8.0_152/bin/java to provide /usr/bin/java (java) in manual mode

7、确认JAVA 版本:

# java –version

输出:

java version “1.8.0_152”

Java(TM) SE Runtime Environment (build 1.8.0_152-b16)

Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)

8、环境变量设置:

用vi 打开并编辑 “/etc/profile”文件,并增加以下内容:

# export JAVA_HOME=/usr/local/jdk1.8.0_*

# export JRE_HOME=/usr/local/jdk1.8.0_*/jre/

# export PATH=$JAVA_HOME/bin:$PATH

以下文章点击率最高

Loading…

发表评论