Introduction

Java is a programming technology originally developed by Sun Microsystems and later acquired by Oracle. Oracle Java is a proprietary implementation for Java that is free to download and use for commercial use, but not to redistribute, therefore it is not included in a officially maintained repository.

There are many reasons why you would want to install Oracle Java over OpenJDK. In this tutorial, we will not discuss the differences between the above mentioned implementations.

Assumptions

This tutorial assumes that you have an account with DigitalOcean, as well as a Droplet running Debian 7 or Ubuntu 12.04 or above. You will need root privileges (via sudo) to complete the tutorial.

You will need to know whether you are running a 32 bit or a 64 bit OS:

i46614161@i46614161:/usr/local/java/jdk1..0_05$ uname -m
i686
  • x86_64: 64 bit kernel

  • i686: 32 bit kernel

Downloading Oracle Java JDK

Using your web browser, go to the Oracle Java SE (Standard Edition) website and decide which version you want to install:

  • JDK: Java Development Kit. Includes a complete JRE plus tools for developing, debugging, and monitoring Java applications.

  • Server JRE: Java Runtime Environment. For deploying Java applications on servers. Includes tools for JVM monitoring and tools commonly required for server applications.

In this tutorial we will be installing the JDK Java SE Development Kit 8 x64 bits. Accept the license and copy the download link into your clipboard. Remember to choose the right tar.gz (64 or 32 bits). Use wget to download the archive into your server:

wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u5-b13/jdk-8u5-linux-i586.tar.gz

Oracle does not allow downloads without accepting their license, therefore we needed to modify the header of our request. Alternatively, you can just download the compressed file using your browser and manually upload it using a SFTP/FTP client.

Always get the latest version from Oracle's website and modify the commands from this tutorial accordingly to your downloaded file.

Or U can visit the website directly and download the tar.gz file do not  visa the command .

Installing Oracle JDK

In this section, you will need sudo privileges:

sudo 
sudo mkdir -p /usr/local/java 
cd /home/"your_user_name"/Downloads
sudo cp -r jdk-8u5-linux-i586.tar.gz /usr/local/java/
cd /usr/local/java
sudo tar xvzf jdk-8u5-linux-i586.tar.gz

Setting Oracle JDK as the default JVM

In our case, the java executable is located under /usr/local/java/jdk1.8.0_05/bin/java . To set it as the default JVM in your machine run:

 sudo  update-alternatives --install /usr/bin/java java  /usr/local/java/jdk1..0_05/bin/java 100
sudo update-alternatives --install /usr/bin/javac javac  /usr/local/java/jdk1.8.0_05/bin/javac 100
sudo update-alternatives --install /usr/bin/javaws javaws  /usr/local/java/jdk1..0_05/bin/javaws 

Verify your installation

Verify that java has been successfully configured by running:

update-alternatives --display java
update-alternatives --display javac

The output should look like this:

java - auto mode
link currently points to /usr/local/java/jdk1..0_05/bin/java
/usr/local/java/jdk1..0_05/bin/java - priority
Current 'best' version is '/usr/local/java/jdk1.8.0_05/bin/java'.
javac - auto mode
link currently points to /usr/local/java/jdk1..0_05/bin/javac
/usr/local/java/jdk1..0_05/bin/javac - priority
Current 'best' version is '/usr/local/java/jdk1.8.0_05/bin/javac'.

Another easy way to check your installation is:

java -version

After installation is complete, set  environment variables as follows

  • Edit the system Path file /etc/profile
sudo gedit /etc/profile
  • Add following lines in end
JAVA_HOME=/usr/local/java/jdk1..0_05
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH

Note:The environment variables modifiy will active after you logout or reboot system .

												

How To Manually Install Oracle Java on Ubuntu的更多相关文章

  1. How to Install Oracle Java 11 on Ubuntu 18.04 LTS (Bionic) Written by Rahul, Updated on April 3, 20

    本文系转载备份 请阅读点击下面链接阅读原文以获取更佳地阅读体验.谢谢. How to Install Oracle Java 11 on Ubuntu 18.04 LTS (Bionic) Writt ...

  2. HOWTO install Oracle 11g on Ubuntu Linux 12.04 (Precise Pangolin) 64bits

    安装了Ubuntu 12.04 64bit, 想在上面安装Oracle 11gr2,网上找了好多文档都没成功,最后完全参考了MordicusEtCubitus的文章. 成功安装的关键点:install ...

  3. centos yum install oracle java

    How to install Java on CentOS 7 | Linuxizehttps://linuxize.com/post/install-java-on-centos-7/ CentOS ...

  4. Install Oracle Java JDK/JRE 7u55 on Fedora 20/19, CentOS/RHEL 6.5/5.10

    What’s new in Sun/Oracle Java 7 VM Compressed 64-bit object pointers Garbage-First GC (G1) JSR 292: ...

  5. oracle java for ubuntu apt-get

    oracle java PPA: ppa:webupd8team/javathe key word use for search more infomation: webupd8team

  6. [转]How to Install Oracle Java 11 in Ubuntu 18.04/18.10

    链接地址:http://ubuntuhandbook.org/index.php/2018/11/how-to-install-oracle-java-11-in-ubuntu-18-04-18-10 ...

  7. install sun java in ubuntu

    1. 下载: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html 2. 解压安装: ...

  8. ubuntu安装oracle java

    通常UBUNTU源中带有openjava,但在使用eclipse与android studio时经常会有莫名奇妙的问题,所以个人觉得还是用oracle java,省点心. 安装步骤如下: sudo a ...

  9. 在Ubuntu 18.04中安装Oracle Java JDK 8

    Webupd8 Team维护一个PPA存储库,其中包含适用于所有当前Ubuntu版本的Oracle Java 8安装程序脚本. 1.打开终端并运行命令添加PPA: sudo add-apt-repos ...

随机推荐

  1. 升级OPENSSH 和 OPENSSL

    升级OPENSSH 和 OPENSSL   首先安装telnet服务,防止在操作过程中导致ssh远程中断   # 安装Telnetyum install telnet-server -y chkcon ...

  2. Java基础——概述

    body, table{font-family: 微软雅黑; font-size: 10pt} table{border-collapse: collapse; border: solid gray; ...

  3. Jenkins插件开发(二)-- HelloWorld

    在上一篇blog中我们讲了如何搭建jenkins插件的开发环境,接下来介绍如何开发我们的插件. 创建HelloWorld插件 学习每门新语言的时候,我们都会写一个HelloWorld程序,这里介绍的是 ...

  4. 由于BOM头导致的Json解析出错

    上周五改完一些BUG后,测试通过就安心在家过了个周末.结果周一回来一看,整个安卓APP所有的接口都挂掉了1.查找bug 首先想到的是客户端代码有问题,然后想起来上周五还能运行得好好的手机也是同样的错误 ...

  5. show()是非模式窗体. showDialog()是模式窗体.

    show()仅仅是显示出来窗口界面而已```也就是和你执行的结果在同一窗口显示```所显示的窗口可以在后台运行```而showDialog()是一个对话框窗口界面```执行结果以新窗口界面出现```不 ...

  6. .net常用正则表达式小结

    好久没有些博客了,今天就随便写点工作当中遇到的一些问题.正则表达式估计大家在开发的过程中都会遇到,下面是我平时用到的以及自己整理的一些常用的正则表达式,供大家学习和参考. "^\d+$&qu ...

  7. Jmeter-线程组执行顺序控制

    线程组按顺序来执行,大概思路, 1.需要控制线程组内的操作在满足某一条件才执行,那么就需要使用if或者while: 2.要使用if或者while都需要一个变量,而这个变量要在两个或多个线程组内使用,那 ...

  8. SpringBoot实现网站注册,邮件激活码激活功能

    项目源码:https://gitee.com/smfx1314/springbootemail 上一篇文章已经讲到如何springboot如何实现邮件的发送,趁热打铁,这篇文章实现如下功能. 很多网站 ...

  9. .NET/C# 使用反射注册事件

    使用反射,我们可以很容易地在运行时调用一些编译时无法确定的属性.方法等.那么如何注册事件呢? 本文将介绍如何使用反射注册事件. 本文内容 不使用反射 使用反射 安全地使用反射 参考资料 不使用反射 例 ...

  10. flask第二十三篇——模板【5】过滤器

    请关注微信公众号:自动化测试实战 过滤器——format格式化 flaskDemo.py # coding: utf-8 from flask import Flask, render_templat ...