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. asp.net验证码图片生成示例

    验证码,一个很常见的东西.不管你是使用者还是开发者,这个东西80%的人都见到过,但是之前有人给我说过这么一句话“内行看门道,外行看热闹!”,仔细琢磨一下还真的是那么一回事.对于怎么实现验证码,闲话不多 ...

  2. Linux下各文件夹的含义和用途

    Linux根目录”/“下各个系统文件夹的含义和用途 1./boot 该目录默认下存放的是Linux的启动文件和内核. 2./initrd 它的英文含义是boot loader initialized ...

  3. 360插件化Replugin爬坑之路

    前言 继上次爬完了热修复的坑位,中途爬了各种各样的坑.今天我们来说说插件化Replugin的坑位.Replugin刚出的时候我就看过了.第一次看的时候可能心态不好.没看懂= =第二次重头在看,发现蛮简 ...

  4. Winform开发之窗体显示、关闭与资源释放

    Winform的窗体涉及到一般窗体(单文档窗体).MDI窗体.窗体之间的关系等,那么如果调用打开新窗体.如何关闭窗体.窗体资源的释放等都关系到软件运行的效率,本文一一介绍 1.窗体的显示 从一个窗体打 ...

  5. 故障处理:磁盘扩容出错:e2fsck: Bad magic number in super-block while trying to open /dev/vdb1

    按照阿里云官网教程对云服务器进行磁盘扩容,使用fdisk重新分区,最后使用e2fsck和resize2fs来完成文件系统层面的扩容 在执行“e2fsck -f /dev/vdb1”命令时报错,如果你的 ...

  6. 使TextView里面的文字滚动起来

    要使TextView里面的内容滚动起来,那么就要配置好几个参数, 1.focusable来获取焦点. 2.ellipsize来获得滚动的方法. 3.focusableInTouchMode来获取触摸方 ...

  7. 从HDU2588:GCD 到 HDU5514:Frogs (欧拉公式)

    The greatest common divisor GCD(a,b) of two positive integers a and b,sometimes written (a,b),is the ...

  8. 使用阿里云docker加速器

    登陆之后,在docker镜像仓库-加速器可获得专有加速地址. 如何使用Docker加速器 针对Docker客户端版本大于1.10的用户 您可以通过修改daemon配置文件/etc/docker/dae ...

  9. springboot整合mybatis增删改查(二):springboot热部署

    SpringBoot整合热部署 传统情况下, 我们用idea运行springboot程序时, 如果我们需要修改类里的方法,或者其他信息 我们需要修改完保存,并且重启springboot,有时候会很浪费 ...

  10. 事务的隔离级别以及oracle中的锁

    事务的概念及特性 事务,一般是指要做的或所做的事情.在计算机术语中是指访问并可能更新数据库中各种数据项的一个程序执行单元(unit). 例如:在关系数据库中,一个事务可以是一条SQL语句,一组SQL语 ...