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's free to download and use for commercial use, but not to Redis Tribute, therefore it is not included in a officially maintained repository.
There is many reasons why do you would want to install Oracle Java over OpenJDK. In this tutorial, we'll not discuss the differences between the above mentioned implementations.
Assumptions
This tutorial assumes it has an account with Digitalocean, as well as a Droplet running Debian 7 or Ubuntu 12.04 or Above. You'll need root privileges (via sudo) to complete the tutorial.
You'll need to know whether your is running a + bit or a A-bit OS:
[Email PROTECTED]:/USR/LOCAL/JAVA/JDK1. 8. 0_05$ uname-mi686
x86_64: Kernel bit
i686: A-bit kernel
Downloading Oracle Java JDK
Using your Web browser, go to the Oracle Java SE (Standard Edition) website and decide which version of the 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 the JVM monitoring and tools commonly required for server applications.
In this tutorial we'll 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 (.) Use wget to download the archive into your server:
wget " 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 R 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'll need sudo privileges:
Sudo
sudo mkdir
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
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. 8100
sudo update-alternatives--install/usr/bin/javac Javac/usr/local/java/jdk1.8.0_05/bin/javac 100
Verify Your Installation
Verify that Java have been successfully configured by running:
Update-alternatives--display Java
Update-alternatives--display Javac
The output should:
Java- Auto mode /usr/local/java/jdk1. 8. 0_05/bin/java/usr/local/java/jdk1. 8 - 'best'/usr/local/java/jdk1.8.0_05/bin/java' .
Javac- Auto mode /usr/local/java/jdk1. 8. 0_05/bin/javac/usr/local/java/jdk1. 8 - 'best'/usr/local/java/jdk1.8.0_05/bin/javac' .
Another easy-to-check your installation is:
Java-version