Under the Mac configuration of the Java environment and MAVEN environment, found that the network configuration methods are different, tried a variety of, now record my configuration after the summary of the method
Java Environment Configuration
1. Download the JDK and follow the prompts to install
I'm under 1.8. Version 0,: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2. View the installed JDK and path
Command line terminal input:
/usr/libexec/java_home-v //view installed JDK and path
Output:
Matching java Virtual machines (1): 1.8"java SE 8" /library /java/javavirtualmachines/jdk1. 8. 0_111.jdk/contents/home
The/library/java/javavirtualmachines/jdk1.8.0_111.jdk/contents/home is the installation path of the JDK.
3. Configure Java_home
Terminal input:
1. CD ~//Enter the user root directory2.Touch. Bash_profile3. Vim. Bash_profile//edit. Bash_profile4. Enter in insert mode: Export Java_home='/library/java/javavirtualmachines/jdk1.8.0_111.jdk/contents/home'Export PATH=${java_home}/Bin: $PATH5. Press ESC to exit Insert mode, enter: Wq Save exit6. source. bash_profile//Update configuration file
4. At this point, the Java development environment is configured
Terminal input: Echo $JAVA _home, if the path you just configured is output, the configuration is successful.
PS: It must be explained that this configuration method only applies to user environment variables, if the system updates, the previous configuration may be invalid, if you want to permanently change the configuration in the/etc directory in the profile file
MAVEN Environment Configuration
1. Download maven:
http://maven.apache.org/download.cgi
2. Unzip the downloaded MAVEN to the appropriate directory
Native directory under/users/zhang/documents/apache-maven-3.3.9
3. Configure the above directory in ~/.bash_profile
1. Vim ~/. Bash_profile2. Enter export Maven_home=/users/zhang/documents/ apache-maven-3.3. 9 export PATH=${maven_home}/bin: $PATH3. Quit after saving 4. source. Bash _profile
4. At this point, the MAVEN environment is configured and tested
Input: Mvn-v
Output:
Apache Maven3.3.9(BB52D8502B132EC0A5A3F4C09453C07478323DC5; -- One-11t00: A: -+ ,:xx) Maven Home:/users/zhang/documents/apache-maven-3.3.9Java Version:1.8. 0_111, Vendor:oracle Corporationjava home:/library/java/javavirtualmachines/jdk1.8.0_111.jdk/contents/home/Jredefault LOCALE:ZH_CN, platform Encoding:utf-8OS Name:"Mac OS X", Version:"10.12.2", Arch:"x86_64", Family:"mac"
This means that both the MAVEN environment and the Java environment are configured.
Java Environment MAVEN environment configuration under MAC