JDK is an important tool which consists the base of Java programming as well as supports many other programming IDEs.
This article introduces the installation method of Oracle jdk 8 on Ubuntu 14.04.
Download Linux jdk 8u60
You could either download the .tar.gz
package from oracle website.
The default download path (not from command terminal) is /Home/Downloads/
.
Decompress the jdk file
Create a folder under /usr/lib
.
If your access is denied, that means you need to use root to realize that.
You can either:
or change directly the right your username group as root:
In the file poped up, find the line with your username, for instance, your username is “blabla” then find “ blabla:x:1000:1000:crystal:/home/linuxidc:/bin/bash”.
Modify the two 1000 to two 0: “blabla:x:0:0:crystal:/home/linuxidc:/bin/bash”. This method is not recommanded since it’s a bit dangerous.
You will find that the start symbol of command line is “#” instead of “$” and you can create the folder again.
Then type the following code (suppose we don’t modify the user right and the downloaded file is saved under /Home/):
Set environment variable
|
|
If you feel sufferred using vi, try to install vim then use it.
Press i
to switch to insert mode and enter the info below:
Press Esc
to quit insert mode. Enter :w!
to save the changes and enter :q
to quit vi.
Source the file and activate the changes.
Set default jdk version
The default version of jdk in some OS is OpenJDK. So you need to specify the default to be jdk from Oracle.
In Ubuntu 14.04 OpenJDK is not preloaded, so I don’t need to do this step.
Test and configure
Check if the installation is successful.
The info returned proves that we’ve successfully installed Oracle jdk 8u60.