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. HDU1754 I hate it_线段树(入门级别)

    I Hate It Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total S ...

  2. 002——数组(二)each() list() implode() explode() in_array()

    <?php /** * 数组(二)each() list() implode() explode() in_array() */ /*implode() 把数组拆分成字符串 * explode( ...

  3. winform学习目录

    Winform混合式开发框架的特点总结 伍华聪 2016-02-26 10:47 阅读:1966 评论:2     代码生成工具Database2Sharp中增加视图的代码生成以及主从表界面生成功能  ...

  4. MySQL数据引擎InnoDB和MyISAM互相转换

    MySQL(或者社区开源fork的MariaDB)5.5以上支持InnoDB引擎,并将其作为默认数据库引擎.InnoDB带来很多改进,但是对系统资源占用明显增加,对于还在128MB-512MB内存VP ...

  5. Python数据类型-01.数字和布尔值

    本节主要介绍Python中的基础知识中的数据类型,数字和布尔值 介绍几个知识点:1)内置函数print()的用法,直接打印括号里面的内容,或者print后跟多个输出,以逗号分隔.2)内置函数type( ...

  6. 新手学Appium_Python_Client

    原文转自http://blog.sina.com.cn/s/blog_68f262210102v538.html 一,Appium_Python_Client的安装 推荐使用pip安装 pip ins ...

  7. Linux菜鸟入门级命令大全

    1. man 对你熟悉或不熟悉的命令提供帮助解释eg:man ls 就可以查看ls相关的用法注:按q键或者ctrl+c退出,在linux下可以使用ctrl+c终止当前程序运行.2. ls 查看目录或者 ...

  8. hadoop之 hadoop 机架感知

    1.背景 Hadoop在设计时考虑到数据的安全与高效,数据文件默认在HDFS上存放三份,存储策略为本地一份,同机架内其它某一节点上一份,不同机架的某一节点上一份.这样如果本地数据损坏,节点可以从同一机 ...

  9. npm查看全局安装过的包

    在使用node的时候,用npm安装了很多软件,过一段时间没有使用就会忘记,怎么查看自己全局安装过的包,用命令 npm list -g --depth 0 在百度里搜不到结果的,我在google里老外的 ...

  10. Android Studio failed to create error code -6解决方法

    起因是AndroidStudio编译太慢,在stackoverflow上找解决方法,创建了个vm选项文件,导致内存不够用 很多中文博客上都千篇一律地说是内存不够,打开安装路径下bin目录下的studi ...