Java Multi-version switching __linux in Linux environment
Source: Internet
Author: User
1. Why to configure environment variables. PATH environment variable-Specifies the command path. For example, we knock Javac Hello.java, and it will follow the path below to find the appropriate command to execute the command. If path does not have this instruction path, we can only do it by CD to the command appropriate clip. With path we can take the executable commands contained under the path path in any directory. classpath-specifies the class search path. To use compiled classes, you can find them, and the JVM looks for classes based on Classpath. Rt.jar is the Java base Class library, Dt.jar is a class library about the running environment, and Tools.jar is the tool class library. The JAVA_HOME-JDK installation directory. Eclipse/netbeans/tomcat and other software is to search Java_home variables to find and use the installed idk. 2.windows Java environment variable configuration. Java_home C:\Java\jdk1.8.0_05 Path;%java_home%\bin;%java_home%\jre\bin CLASSPATH.; %java_home%\lib;%java_home%\lib\dt.jar;%java_home%\lib\tools.jar
3.linux Multi-version JDK switch configuration. Vim~/.bash_profile Export Java_9_home=/library/java/javavirtualmachines/jdk-9.0.1.jdk/contents/home Export JAVA_8_ Home=/library/java/javavirtualmachines/jdk1.8.0_152.jdk/contents/home Export java_6_home=/library/java/ Javavirtualmachines/1.6.0.jdk/contents/home export java_home= $JAVA _8_home alias jdk9= "Export java_home= $JAVA _9_home "Alias jdk8=" Export java_home= $JAVA _8_home "Alias jdk6=" Export java_home= $JAVA _6_home " 4. How to add a new path:For example, add a MAVEN maven_home=/users/admin/documents/3.2.2/apache-maven-3.2.2 path= $MAVEN _home/bin: $PATH export Maven_ Home export path You can add the specified path yourself, separated by a colon in the middle. When the environment variable is changed, it will take effect the next time the user logs on, and if you want to take effect immediately, you can execute the following statement: $ source. bash_profile
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service