Install Oracle jdk6,7 or 8 in Ubuntu 14.04.
Preparing: Adding Add-apt-repository Tools
Install python-software-properties
#apt-get Install Software-properties-common
First step: Add PPA repository to the system
#add-apt-repository Ppa:webupd8team/java
Step Two: Update
#apt-get Update
Step three: Download and install the JDK
Install Oracle-java6-installer
Here is the installation of JDK6, if you want to install JDK7 or JDK8, the above statement 6 to the corresponding number can be changed.
Fourth Step: Set as Default (skip this step if you don't have another version of the JDK installed)
Install Oracle-java6-set-default
Similarly, it is necessary to change the 6 to the corresponding 7 or 8.
Fifth Step: View version
#java-version
Sixth step: Setting environment variables
At the end of the/etc/profile file, add:
#vi /etc/profile
Add at the end of the file
#jdkexport java_home=/usr/lib/jvm/java-6-oracleexport jre_home=${java_home}/JRE export CLASSPATH=.:${java_home}/lib:${jre_home}/lib export PATH
To set up our installed JDK as the default JDK version, do the following.
Execute code:
#update-alternatives--install /usr/bin/java java/usr/lib/jvm/java-7300
#update-alternatives--config Java
Ubuntu14.04 Installing Oracle JDK