1. Download JDK
Address: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2. Extract the files just downloaded to the/USR/LIB/JVM directory, assuming there is no such directory. Ability to create new catalogs
Cp-r/home/xx/Download/JDK1.8.0_25/USR/LIB/JVM
3. Configure Environment variables
Typing command:
gedit~/. BASHRCOn the last join:
1234 |
ExportJava_home=/usr/Lib/JVM/jdk1.8.0_25ExportJre_home=${Java_home}/JREExportCLASSPATH=.:${Java_home}/Lib:${Jre_home}/LibExport PATH=${Java_home}/bin:$PATH |
Save exit, enter the following command to make the environment variable for this configuration take effect
4. Configure the default JDK version number to run the following commandsudoUpdate-Alternatives--Install/usr/bin/JavaJava/usr/Lib/JVM/jdk1.8.0_25/bin/Java -sudoUpdate-Alternatives--Install/usr/bin/JavacJavac/usr/Lib/JVM/jdk1.8.0_25/bin/Javac -5. TestOpen a terminal input dimly command java-version
Outputjava Version "1.8.0_25"
Java (TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot (TM) Server VM (build 25.25-b02, Mixed mode)
It represents a successful test.
Linux installation JDK 8 and environment variable configuration