Java代码信息

运行结果
教程手册
代码仓库
点击编辑器上方的运行按钮,会在此处显示运行结果。
以下是用户最新保存的代码
主函数-- 发布于:2020-08-10 17:17 主函数-- 发布于:2020-08-10 17:16 主函数-- 发布于:2020-08-10 17:16 定义类-学生-继承自人类 发布于:2020-08-10 17:11 自动截取日本名称 发布于:2020-08-08 12:10 Base64 发布于:2020-08-07 14:37 池塘问题,待修改 发布于:2020-08-10 14:36 自动截取日本名称 发布于:2020-08-08 11:57 API random (摇塞子游戏) 发布于:2020-08-06 15:05 Nginx log escape 发布于:2020-08-07 15:55 《算法》练习1.1.6 发布于:2020-08-04 21:29 排序... 发布于:2020-08-04 22:10 斐波那契函数 发布于:2020-08-04 15:37 《算法》练习1.1.5 发布于:2020-08-03 23:41 《算法》练习1.1.3 发布于:2020-08-03 22:13 《算法》练习1.1.2 发布于:2020-08-03 20:37 《算法》练习1.1.1 发布于:2020-08-03 19:24 jvaaaaa 发布于:2020-08-03 14:16 练习加深印象 发布于:2020-08-03 13:54 测试显目1 发布于:2020-07-31 16:20 hh-test 发布于:2020-07-30 10:28 聊天小工具。 发布于:2020-07-30 09:40 使用for循环嵌套实现99乘法表。 发布于:2020-07-29 21:22 for循环嵌套练习。 发布于:2020-07-29 19:55 加深三目运算符练习。 发布于:2020-07-29 13:50 逻辑运算符加深印象。 发布于:2020-07-29 13:38 写着玩的东西 发布于:2020-07-30 11:26 算算舍罕王给了多少粒麦子 发布于:2020-07-27 22:48 leetcode 发布于:2020-07-27 01:29 java练习输出打印1到100的奇数和偶数。 发布于:2020-07-25 15:03 test1 发布于:2020-07-24 14:16 第三届天命杯Roll图/模式 发布于:2020-07-23 20:17 用if和else循环判断是雨天还是睛天,男女的状态 发布于:2020-07-23 18:23 用switch循环判断男女还有天气 发布于:2020-07-23 18:22 用switch循环判断输入的数值是星期几。 发布于:2020-07-23 18:22 这个源码是表示商场打折判断写法 发布于:2020-07-23 18:21 这个源码是写用if判断成绩的 发布于:2020-07-23 18:19 用来正实是否是质数的写法 发布于:2020-07-23 18:17 一个登陆功能小文本 发布于:2020-07-23 18:15 用一个递归和一个for循环来表示两个数据 发布于:2020-07-23 18:13 java豪宅房租计算脚本 发布于:2020-07-23 17:49 java练习 发布于:2020-07-23 16:28 输出语句,是System.out.println的... 发布于:2020-07-23 10:27 测试三元运算符 发布于:2020-07-22 19:35 【基础】-数据结构 发布于:2020-07-23 22:40 测试数据类型之间的自动转换和强制转换 发布于:2020-07-22 10:32 java Queue 应用,先进先出用法实例, ... 发布于:2020-07-21 17:16 服务器代码 发布于:2020-07-20 10:59 客户端代码 发布于:2020-07-20 11:53 [更多]
显示目录

How to Install Oracle JDK 8 On Debian

![java8-debian][] java8-debian

In this tutorial, we will show you how to install Oracle JDK 8 On Debian, manually.

Environment :

  1. Debian 7
  2. OpenJDK 1.7 is installed. (Switch to Oracle JDK 8 later)

At the time of writing, OpenJDK 1.8 is not included in the default apt-get repository yet. I just don’t like the default apt repository schedule, it constantly comes with older or outdated released.

Note
This guide is tested in other Debian derivatives like Ubuntu 14 and Mint 1.7.2.

1. Quick Check

1.1 A quick Java version check :

$ java -version
java version "1.7.0_75"
OpenJDK Runtime Environment (IcedTea 2.5.4) (7u75-2.5.4-1~deb7u1)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)

$ javac -version
javac 1.7.0_75

An existing OpenJDK 1.7 is installed, no problem, we will show you how to switch it to JDK 8.

1.2 A quick search via apt-cache, there is no openjdk-8… yet.

$ apt-cache search openjdk

...
openjdk-7-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-7-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
openjdk-6-jre - OpenJDK Java runtime, using Hotspot JIT
openjdk-6-jre-headless - OpenJDK Java runtime, using Hotspot JIT (headless)
...

2. Get Oracle JDK 8

1.1 Visit Oracle JDK download page

1.2 Find a Linux x64 version, in this example, we will get the jdk-8u66-linux-x64.tar.gz via wget command.

$ pwd
/home/mkyong

$ wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u66-b17/jdk-8u66-linux-x64.tar.gz

If you don’t want to use wget (why?), just download the file and upload to your server manually.

3. Extracts to /opt/jdk/

3.1 Extracts it to path /opt/jdk/jdk1.8.0_66

$ pwd
/home/mkyong

$ sudo mkdir /opt/jdk/
$ sudo mv ~/jdk-8u66-linux-x64.tar.gz /opt/jdk/
$ sudo cd /opt/jdk/

$ pwd
/opt/jdk/

$ sudo tar -zxf jdk-8u66-linux-x64.tar.gz 
$ ls -ls
total 177056
     4 drwxr-xr-x 3 root root      4096 Oct 27 13:05 .
     4 drwxr-xr-x 3 root root      4096 Oct 27 13:03 ..
     4 drwxr-xr-x 8 uucp  143      4096 Oct  7 00:40 jdk1.8.0_66
177044 -rw-r--r-- 1 root root 181287376 Oct  8 15:56 jdk-8u66-linux-x64.tar.gz

Note
Alternatively, try this one line extraction command.

$ sudo tar x -C /opt/jdk -f jdk-8u66-linux-x64.tar.gz

4. Install JDK

4.1 Make /opt/jdk/jdk1.8.0_66 as a new JDK alternatives for both /usr/bin/java and /usr/bin/javac

$ sudo update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_66/bin/java 100
$ sudo update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_66/bin/javac 100

4.2 Update the default JDK, for both java and javac

$ update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1051      auto mode
* 1            /opt/jdk/jdk1.8.0_66/bin/java                    100       manual mode
  2            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1051      manual mode

Press enter to keep the current choice[*], or type selection number: 1
update-alternatives: using /opt/jdk/jdk1.8.0_66/bin/java to provide /usr/bin/java (java) in manual mode
$ update-alternatives --config javac
There are 2 choices for the alternative javac (providing /usr/bin/javac).

  Selection    Path                                         Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-7-openjdk-amd64/bin/javac   1051      auto mode
* 1            /opt/jdk/jdk1.8.0_66/bin/javac                100       manual mode
  2            /usr/lib/jvm/java-7-openjdk-amd64/bin/javac   1051      manual mode

Press enter to keep the current choice[*], or type selection number: 1
update-alternatives: using /opt/jdk/jdk1.8.0_66/bin/javac to provide /usr/bin/javac (javac) in manual mode

5. Verification

Check Java version again.

$ java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
root@hydra:/opt/jdk# 

$ javac -version
javac 1.8.0_66

Done. Enjoy your Lambda!

6. Extras… How to Upgrade?

Let say new jdk1.8.0_99 is released, and we want to upgrade it.

6.1 Download the JDK tar files and extracts it to /opt/jdk/jdk1.8.0_99

6.2 Self-explanatory.

# 6.2.1 Remove the existing alternatives - jdk1.8.0_66
$ sudo update-alternatives --remove java /opt/jdk/jdk1.8.0_66/bin/java
$ sudo update-alternatives --remove javac /opt/jdk/jdk1.8.0_66/bin/javac

# 6.2.2 Install new JDK alternatives - jdk1.8.0_99
$ sudo update-alternatives --install /usr/bin/java java /opt/jdk/jdk1.8.0_99/bin/java 100
$ sudo update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_99/bin/javac 100

# 6.2.3 Update default JDK again, select /opt/jdk/jdk1.8.0_99
$ update-alternatives --config java 
$ update-alternatives --config javac

# 6.2.4 Remove the old JDK folders
$ sudo rm -rf /opt/jdk/jdk1.8.0_66/

How about upgrade to the upcoming Oracle JDK 9? you know what to do :)

References

  1. Using the Debian alternatives system
  2. How To Manually Install Oracle Java on a Debian or Ubuntu VPS
  3. Debian : Change default Java version
  4. Oracle JDK download page

[java8-debian]:

由JSRUN为你提供的Java在线工具
        JSRUN提供的Java在线运行,Java 在线编译工具,基于linux操作系统环境提供线上编译和线上运行,具有运行快速,运行结果与常用开发、生产环境保持一致的特点。

title

使用此草稿 删除草稿