The JDK is a popular development toolkit that contains the JRE that is the component that supports the JVM running.01. JDK Downloadhttp://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html02. JDK DecompressionTar zxf jdk-8u131-linux-x64.tar.gz03, the configuration of the JDK environment variable
- A configuration file/etc/profile (global level) that modifies environment variables directly. bash_profile (user-level)
Vim/etc/profileexport java_home=/elk5.4/jdk1.8.0_131export jre_home= $JAVA _home/jreexport CLASSPATH=.: $JAVA _home/ Lib: $JRE _home/libexport path=$PATH: $JAVA _home/bin: $JRE _home/bin #这种不会替换的当前的Java的环境变量 Export path= $JAVA _home/bin: $JRE _home/bin:$PATH # $PATH write to the back, can be replaced. The bin under path is in a sequential ordersource/etc/profile #更新 Env #明白了吧, Java in frontPath=/root/jdk1.8.0_131/bin:/root/jdk1.8.0_131/jre/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usR/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
- Quickly switch JDK versions with update-alternatives
Usage:Alternatives--install <link> <name> <path> <priority>[--initscript <service>] [--slave <link> <name> <path>]* Alternatives--remove <name> <path> Alternatives --auto <name> Alternatives--config <name> alternatives--display <name> Alternatives --set <name> <path> Common options:--verbose--test--help--usage--version--altdir <directory> --admindir <directory> #默认通过jdk-rpm installed [[email protected] ~]# ll/usr/bin/javalrwxrwxrwx. 1 root root 22 May 14 11:58/usr/bin/java-/etc/alternatives/java[Email protected] ~]# Ll/etc/alternatives/java lrwxrwxrwx. 1 root root 29 May 14 11:58/etc/alternatives/java-/elk5.4/jdk1.8.0_131/bin/javaoptions for adding JDKUpdate-alternatives--install/usr/bin/java Java/elk5.4/jdk1.8.0_131/bin/javaSelect the current JDK version[Email protected] ~]#update-alternatives--config JavaA total of 4 programs provide "Java". Select Command-----------------------------------------------* 1/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java 2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java 3/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java + 4/e Lk5.4/jdk1.8.0_131/bin/java Press Enter to save the current selection [+], or type select number 4 that is, when the pro-Java environment variable learning is endless, the problem is always inadvertently appeared, the ancestors have come up with a solution.
LINUX-JAVA-JDK Complete Configuration process