1.http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Download a. tar.gz file
2. Configure Environment variables
After the download is complete, double-click Unzip, after the decompression is complete, press Ctrl+alt+t to open the terminal, enter the following command
sudo gedit/etc/environment
The System Environment Configuration window is then opened
Copy the path of the JDK to the bin level directory, as mine is
/home/liwen/programs/jdk8/bin
The following path please fill in your own JDK path, the path is enclosed in double quotation marks
Add after path::/home/liwen/programs/jdk8/bin
(colon equivalent to semicolon under windows, split environment variable)
Add in the following:
Java_home= "/home/liwen/programs/jdk8"
Classpath= "/home/liwen/programs/jdk8/lib:."
Ctrl + S Save
Enter the command sudo source/etc/profile to take effect, and then use the command java-version, if you see the Java version information, it means that the installation was successful.
At this point, however, only the thread that executes the sudo source/etc/profile command can use the JAVA environment variable, while the other threads are not.
After the reboot, it's all done.
Part quoted from Http://wenku.baidu.com/view/55e95da0690203d8ce2f0066f5335a8102d26666.html?from=search
and http://jingyan.baidu.com/article/e2284b2b61a2efe2e6118d39.html
How to configure the Java environment for Ubuntu