1, install the JDK, reference
1. Download JDK 8
Choose to download the latest JDK version of JDK 8 from http://www.oracle.com/technetwork/java/javasebusiness/downloads/.
2. Unzip the file
$ sudo MKDIR/USR/LIB/JVM
$ sudo mv jdk-8u5-linux-i586.tar.gz/usr/lib/jvm/
$ cd/usr/lib/jvm/
$ sudo tar-zxvf jdk-8u5-linux-i586.tar.gz
$ rm./jdk-8u5-linux-i586.tar.gz
3. Configuration
$ sudo gedit/etc/environment
Modify path in environment, append JDK path, add classpath and Java_home as follows:
Path= "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/jdk1.8.0_05/bin"
Classpath= "/usr/lib/jvm/jdk1.8.0_05/lib"
Java_home= "/usr/lib/jvm/jdk1.8.0_05"
And then we're going to tell the system that we're using Sun's JDK, not OPENJDK:
$ sudo update-alternatives--install/usr/bin/java java /usr/lib/jvm/jdk1.8.0_05/bin/java
$ sudo update-alternatives--install/usr/bin/javac javac/usr/lib/jvm/ Jdk1.8.0_05/bin/javac
$ sudo update-alternatives--config java
has 2 candidates that can be used to replace Java (providing/usr/bin/java).
Select path and nbsp priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 Auto mode
1 / Usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 Manual mode
2 /usr/lib/jvm/jdk1.8.0_ 05/bin/java 300 Manual mode
to maintain the current value [*] press ENTER, or type the number of your selection: 2
As shown above, this will set up the Java to be used.
4. Test Run Java-version
The installation succeeds as follows:
Java Version "1.8.0_05"
Java (TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot (TM) Server VM (build 25.5-b02, Mixed mode)
Ubuntu 14.04 Installing JDK 8