Java Environment MAVEN environment configuration under MAC

Source: Internet
Author: User
Tags java se

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

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.