1. First download JDK from the official JDK website.
2. Then, download the downloaded JDK package (jdk-8u20-linux-i586.tar.gz), open the shell, go to the super administrator permission, and enter the downloaded directory (CD directory name ), then copy the downloaded package or move it to the/usr/directory (CP jdk-8u20-linux-i586.tar.gz/usr/or MV jdk-8u20-linux-i586.tar.gz/usr /).
3. decompress the file in shell with the command, sudo tar-zxvf jdk-8u20-linux-i586.tar.gz, You can decompress the file to the/usr/directory.
4. Configure the environment variable sudo gedit/etc/profile like Windows. Add the following statement at the end of the file (confirm your path ):
Export java_home =/usr/jdk1.8.0 _ 20
Export jre_home =/usr/jdk1.8.0 _ 20/JRE
Export Path = $ java_home/bin: $ java_home/JRE/bin: $ path
Export classpath = $ classpath:.: $ java_home/lib: $ java_home/JRE/lib
5. modify the system's default JDK to make it take effect immediately (confirm your path ):
Sudo Update-alternatives -- install "/usr/bin/Java" "Java" "/usr/jdk1.7.0 _ 17/bin/Java" 300
Sudo Update-alternatives -- install "/usr/bin/javac" "javac" "/usr/jdk1.7.0 _ 17/bin/javac" 300
Sudo Update-alternatives -- install "/usr/bin/javaws" "javaws" "/usr/jdk1.7.0 _ 17/bin/javaws" 300
Sudo Update-alternatives -- config Java
Sudo Update-alternatives -- config javac
Sudo Update-alternatives -- config javaws
6. Now the configuration is complete. Enter Java-version in shell. The following code indicates that the configuration is complete.
[email protected]:/usr# java -versionjava version "1.8.0_20"Java(TM) SE Runtime Environment (build 1.8.0_20-b26)Java HotSpot(TM) Server VM (build 25.20-b23, mixed mode)