1. Download JDK from the official website. Download jdk-7u25-linux-x64.tar.gz 2 and create the installation directory.
Sudo mkdir/usr/lib/jvm
3. decompress the package
Tar zxvf./jdk-7u25-linux-x64.tar.gz-C/usr/lib/jvm
4. Configure the environment variable gedit ~ /. Bashrc
Add the following content at the bottom of the file: export JAVA_HOME =/usr/lib/jvm/jdk1.7.0 _ 25
3 export JRE_HOME =$ {JAVA_HOME}/jre4export CLASSPATH =.: $ {JAVA_HOME}/lib :$ {JRE_HOME}/lib5export PATH =$ {JAVA_HOME}/bin: $ PATH 5. Close the terminal and open it again. Run the following command:
1update-alternatives -- install/usr/bin/java/usr/lib/jvm/jdk1.7.0 _ 25/bin/java 3002update-alternatives -- install/usr/bin/javac/usr/lib/jvm /jdk1.7.0 _ 25/bin/javac 300 and then enter: update-alternatives -- config java and then you will see: select 2 and then OK ~ Haha ~ 6. Enter java-version on the terminal.
JDK replaced ~