This paper introduces a general installation method, which can be installed by Linux system. This article takes the JAVA8 environment as an example to configure. 1.JDK downloads into the Java download page (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html), Download the Java JDK and selectjdk-8u161-linux-i586.tar.gz"File, download to local. 2.JDK installation Because the operation under the Usr/lib directory requires administrator privileges, add sudo before the command
- Confirm that there is a JVM folder under the/usr/lib/directory, and if you do not create a JVM folder with sudo permissions (go to that directory, sudo mkdir JVM)
- Unzip the downloaded file into the directory (command: sudo tar zxvf./jdk-8u161-linux-i586.tar.gz-c/USR/LIB/JVM)
3. Environment path Configuration Open the environment path file: sudo vi ~/.profileAdd the following statement to the end of the text:
Export JAVA_HOME=/USR/LIB/JVM/JDK1. 8 . 0_161export jre_home=${java_home}/jreexport CLASSPATH=.:${java_home}/lib:${jre_home}/ Libexport PATH=${java_home}/bin: $PATH
SOURCE ~/.profile, update environment variable 4. Results test input java-version, if prompted for Java version information, the installation is successful5. Summary of Commands
sudo mkdir jvmsudo tar zxvf. /jdk-8u161-linux-i586.tar.gz -c/usr/lib/~/. Profileexport java_home=/usr/lib/jvm/jdk1. 8. 0_161export jre_home=${java_home}/jreexport CLASSPATH=.:${java_home}/lib:${jre_home}/ libexport PATH=${java_home}/~/
6. Issues that may arise:(1) Program ' Java ' is included in the following packages
' Java ' is included in the following packages: default-JRE* gcj-4.9-jre-Headless* gcj-5-jre-Headless* openjdk-8-jre-Headless* gcj-4.8-jre-Headless* openjdk-9- jre-< selected packages >
Workaround: Manually set the system default JDK
In the terminal, enter the command in turn:
sudo update-alternatives--install/usr/bin/javac javac/usr/jvm/jdk1. 8 - sudo update-alternatives--config java
You can then enter Java-version to see the version information for the installed JDK.
The Question Reference blog: http://blog.csdn.net/vicky__rain/article/details/5353943
Configuration of the Java Development environment under Linux (Ubuntu 16) (i)------JDK configuration