Install jdk 8 in Linux and configure environment variables.
1. Download jdk
Address: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2. decompress the downloaded file to the/usr/lib/jvm folder. If this folder does not exist, you can create a new folder.
Cp-r/home/xx/download/jdk1.8.0 _ 25/usr/lib/jvm
3. Configure Environment Variables
Run the following command:
Gedit ~ /. Add bashrc at the end:
| 1234 |
Export JAVA_HOME =/usr/lib/jvm/jdk1.8.0 _ 25 export JRE_HOME =$ {JAVA_HOME}/jreexport CLASSPATH =.: $ {JAVA_HOME}/lib :$ {JRE_HOME}/libexport PATH =$ {JAVA_HOME}/bin: $ PATH |
Save and exit. Enter the following command to make the environment variable of the configuration take effect.
4. Configure the default jdk version and run the following command: sudo Update-alternatives -- Install /Usr/bin/java Java /Usr/lib/jvm/jdk1.8.0 _ 25/bin/java 300 sudo Update-alternatives -- Install /Usr/bin/javac Javac /Usr/lib/jvm/jdk1.8.0 _ 25/bin/javac 3005 open a terminal and enter the java-version command.
Output java 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)
Indicates that the test is successful.