Build a Java development environment under Mac

Source: Internet
Author: User

Note: The place where the red font is marked is variable, please modify it according to your own circumstances; Maven's version number is 3, but we still use M2 to configure it.

1, installation Jdk:mac system comes with JDK, but version is 1.6, older, we need to download the latest Java8on the official website, installation is relatively simple, the next fool-style can be.

2, configure the JDK environment variable: terminal input vim ~/.bash_profile press ENTER, enter edit mode after entering the following content:

JAVA_HOME=/LIBRARY/JAVA/JAVAVIRTUALMACHINES/JDK1.8.0_60. jdk/contents/home

Path= $JAVA _home/bin: $PATH:.

Classpath=java_home/lib/tools.jar: $JAVA _home/lib/dt.jar:.

Export Java_home

Export PATH

Export CLASSPATH

Press ESC:WQ to enter, save exit after entering source ~/.bash_profile in terminal to make the file take effect.

Terminal input Java-version can view Java version, Whereis Java can view Java location, echo $JAVA _home can print out java_home.

3. Install eclipse: Unzip after download, drag the. app file into application, then create a workspace, which is the workspace, where the code is stored.

4. Eclipse configuration jdk: Open Eclipse, Preferences, java,installed, tick 1.8 version, Apply,ok.

5. Install Tomcat: Unzip after download, put the folder in the location you want to put, open eclipse, preferences, find Server,tomcat,add, choose Path, Apply,ok.

6. Download maven: Unzip the download and put it where you want it.

7, configure the MAVEN environment variable: terminal input vim ~/.bash_profile Press ENTER, enter the edit mode after adding the following content:

m2_home=/users/wangpeng/mydir/apache-maven-3.3.9

Path= $JAVA _home/bin: $M 2_home/bin: $PATH:.

Export M2_home

Press ESC:WQ to enter, save exit after entering source ~/.bash_profile in terminal to make the file take effect.

The terminal input mvn-version or mvn-v can view maven related information, echo $M 2_home can print out m2_home.

8. Eclipse Configuration maven: Open Eclipse, Preferences, find Maven,installations,add, select Path, Apply,ok.

9, the database installation has already written a blog, here no longer repeat, if necessary, please consult, Portal: "Mac OS X mysql installation, configuration and uninstallation"

The final version of the. bash_profile file is as follows:

# sql

Alias mysql= '/usr/local/mysql/bin/mysql '

Alias mysqladmin= '/usr/local/mysql/bin/mysqladmin '

# ls

Alias ls= ' Ls-g '

JAVA_HOME=/LIBRARY/JAVA/JAVAVIRTUALMACHINES/JDK1.8.0_60. jdk/contents/home

m2_home=/users/wangpeng/mydir/apache-maven-3.3.9

Path= $JAVA _home/bin: $M 2_home/bin: $PATH:.

Classpath=java_home/lib/tools.jar: $JAVA _home/lib/dt.jar:.

Export Java_home

Export PATH

Export CLASSPATH

Export M2_home

Build a Java development environment under Mac

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.