Install and configure the Java environment in Ubuntu 16.04 LTS
We know that openjdk may be installed in Ubuntu in advance. But I am used to Oracle jdk.
##< Uninstall openjdk>
### Terminal command: sudo apt-get purge openjdk/openjdk *; sudo apt-get clean/autoclean;
We should delete openjdk from the system.
# <Download and install Oracle jdk>
### Terminal command: tar-zxvf jdk-8u77-linux-x64.tar.gz;
Sudo mv./jdk-8u77-linux-x64/opt/Java
Download Oracle jdk needs to Oracle (http://www.oracle.com/) Oracle jdk official website (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html), according to different operating systems provide different installation packages, download the corresponding software packages.
Decompress the package on the Ubuntu Desktop and move it to/opt/Java. In this way, a separate folder is provided for you to manage and set environment variables. Now, if everything is correct, let's <I> set the environment variable </I>.
# <Jdk environment variable Settings>
### Terminal command: sudo gedit/etc/profile; source/etc/profile
'''
Export JAVA_HOME =/opt/Java/java version
Export JRE_HOME =$ {JAVA_HOME}/jre
Export CLASSPATH =.: java h ome/lib: JAVAHOME/lib: {JRE_HOME}/lib
Export PATH = java h ome/bin: JAVAHOME/bin: PATH
'''
Test whether the environment variables are correctly set
'''
$ Java-version
$ Javac
'''
##< Install eclipse>
### Terminal command:
Sudo tar-zxvf eclipse=java%mars%2%linux%gtk%x86_64.tar.gz;
Mv./eclipse-java-mars-2-linux-gtk-x86_64
Eclipse, as an open-source software, is suitable for java development. Eclipse (http://www.eclipse.org/) Linux X64 version (http://mirrors.ustc.edu.cn/eclipse/technology/epp/downloads/release/mars/2/eclipse-java-mars-2-linux-gtk-x86_64.tar.gz). Unzip it and put it in the folder you feel suitable.