Java在线运行

版本:

所属目录
点击了解高性能代码运行API
运行结果
教程手册
代码仓库
极速运行
交互输入
极速运行模式,更高效的运行,点击编辑器上方的运行按钮即刻体验吧。
以下是用户最新保存的代码
for循环嵌套 发布于:2022-11-08 13:58 仿沙卡拉六级梯形金字塔(初版) 发布于:2022-11-08 10:25 测试变量变化 发布于:2022-11-06 22:18 二分查找:查找最后一个小于等于给定值的元素: 发布于:2022-11-06 00:13 二分查找:查找第一个大于等于给定值的元素: 发布于:2022-11-06 00:09 二分查找的变形 :查找最后一个值等于给定值的元素 发布于:2022-11-06 00:02 实现二分查找 发布于:2022-11-05 23:02 输出1-10之间的偶数(while) 发布于:2022-11-07 10:00 输出1-10之间所有偶数(for) 发布于:2022-11-07 10:02 输出1-10之间10个数的和 发布于:2022-11-05 16:06 输出1-10之间的10个整数 发布于:2022-11-05 16:04 跨银行交易系统 发布于:2022-11-05 15:40 收支系统verson 1.0 发布于:2022-11-05 14:09 求1到100奇数的和 发布于:2022-11-05 11:02 测试代码。 发布于:2022-11-04 09:35 交互输入一个三位数,分别输出这个三位数的个位、十位、百位。 发布于:2022-11-03 15:53 输入账户判断 发布于:2022-11-03 15:23 年轻人,你还是太嫩了 发布于:2022-11-03 13:04 空心金字塔 发布于:2022-11-02 15:58 我女神丽丽 发布于:2022-11-01 15:58 计数排序:2 5 3 0 2 3 0 3 发布于:2022-11-01 12:42 桶排序:78 17 39 26 72 94 21 12 23 68 发布于:2022-11-01 11:34 java用treeset集合实现不重复的数列 发布于:2022-11-01 08:42 获取用户信息 发布于:2022-10-31 12:22 ArrayList类银行取款 发布于:2022-10-31 11:54 FinalShell的离线机器码 发布于:2022-10-30 12:06 AAB前身代码 发布于:2022-10-29 20:35 查找AAB类型单词 发布于:2022-10-29 20:21 松岛枫是的肤色饭 发布于:2022-10-28 15:23 二维数组式 发布于:2022-10-26 20:24 java List 排序 数字字符串 发布于:2022-10-25 09:34 网络报文加密解密 发布于:2022-10-24 18:17 字符串变形 发布于:2022-10-24 18:16 归并排序实现 发布于:2022-10-23 22:34 快速排序实现: 发布于:2022-10-23 21:48 混合项目测试 发布于:2022-10-23 21:33 奇偶数之和判断 发布于:2022-10-23 20:25 解题:跳跃游戏(优先队列,大堆) 发布于:2022-10-23 17:03 分治法2-10-15-课堂练习-md.6 发布于:2022-10-20 19:58 java实现员工工资管理系统 发布于:2022-10-19 10:41 回文数递归法 发布于:2022-10-18 22:09 回文数递推法 发布于:2022-10-18 22:08 农民分土地 发布于:2022-10-18 16:07 字符串的输入,字符出现次数 发布于:2022-10-17 20:47 元音字母小写 发布于:2022-10-17 20:12 农民分土地递推实现: 发布于:2022-10-15 13:23 数组累加递推实现: 发布于:2022-10-15 13:15 数组累加递归实现: 发布于:2022-10-15 13:03 农民分土地递归实现: 发布于:2022-10-15 12:55 设计一个输出如下形式数值的递归算法 n n n n n … n … 3 3 3 2 2 1 发布于:2022-10-15 00:58 [更多]
显示目录

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

使用此草稿 删除草稿

  • 00:23
注册登录后可减少验证码的弹出,点击前往 注册 | 登录

皮肤:

运行模式:

嵌入代码 iframe嵌入:


服务器已安装大部分常用的依赖库,但仍会存在一些未被安装的库, 可以通过本窗口立即安装所需依赖库,请确保库名正确,否则无法安装成功。


请输入依赖库的名称:

请选择语言: