Setting up the Java development environment on the MacBook Pro

Source: Internet
Author: User
Tags macbook

Well, I went to the other side of the world, and because my PC wasn't there, only one MacBook Pro could be used for development. This article should be seen as an enhanced bookmark, and I've listed all the necessary tools to make the MacBook work, that is, for Java and later for JavaScript.

What I need to mention is that until now, I'm still a Windows user (XP/7) and Linux (Ubuntu/mint/cent OS). While writing this article, I ran OS X Yosemite Version 10.10.5 on my MacBook Pro.

Jdk

So first thing to do, install the Java SDK (JDK), a software development environment for developing Java applications and applets. It includes the Java Runtime Environment (JRE), Interpreter/loader (Java), compiler (JAVAC), archive (jar), document Generator (Javadoc), and other tools required for Java development.

Download Mac OS X x64. DMG Version files

    • Java 7
    • Java 8

You can find the installation location of the JDK by executing the/usr/libexec/java_home-v 1.7 command at the terminal command line:

123456789 Adrians-MacBook-Pro:ama ama$ /usr/libexec/java_home -v 1.8/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home Adrians-MacBook-Pro:ama ama$ /usr/libexec/java_home -v 1.7 /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/HomeAdrians-MacBook-Pro:ama ama$
For example, you need to know this when you create a new project in IntelliJ. Set Java_home

Java_home is just a convention, typically used for Tomcat, other Java EE program servers, and tools such as Maven to find a place to live in Java.

In Mac OSx 10.5 and later, Apple recommends setting the $java_home to the path /usr/libexec/java_home , just $JAVA_HOME exporting to a file ~/. bash_profile or ~/.profile .

123456789 $ vim .bash_profile export JAVA_HOME=$(/usr/libexec/java_home) $ source .bash_profile $ echo $JAVA_HOME/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home
Maven

After setting up the java_home in the manner indicated above, go to the Apache Maven downloads url, download the. tar.gz or. zip file, and unzip it in one folder-I put it under the/opt folder:

1 tar xzvf apache-maven-3.3.3-bin.tar.gz
It is recommended that you create a link to the MAVEN installation so that if you want to update the MAVEN version, you only need to change the link target:
1 ln -s /opt/apache-maven-3.3.3/opt/maven

Then set maven in the environment variable:

Vim ~/.bash_profile
12345 export M2_HOME=/path/to/mavenexport M2=$M2_HOME/binexport PATH=$M2:$PATH

Close the terminal and open a new one. If you want to get the MAVEN version now, you should look like this:

12345678910111213 ama$ mvn -versionApache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T13:57:37+02:00)Maven home: /opt/mavenJava version: 1.8.0_65, vendor: Oracle CorporationJava home: /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8OS name: "mac os x", version: "10.10.5", arch: "x86_64", family: "mac"

Another option is to use homebrew and run the following command:

1 brew install maven
Git

Open a terminal window and enter the following command:

1 $git --version

Next you need to install Xcode. If you want to develop an app on Apple TV, Apple Watch, IPhone, IPad, and Mac, this is a very comprehensive set of developer tools. Includes Xcode IDE, emulator, and all the tools and frameworks needed to create Ios,watchos,tvos and OS X apps (also including GNU Compiler COLLECTION-GCC).

You can follow the instructions above to install, but if you don't want everything to get from the installation package, you can install a homebrew ("Homebrew can install programs you need and Apple doesn't need." "), and run the following command:

123 brew install gccbrew install git

Whichever method you use, after the GIT installation is complete, the initial command git-version can see the installation version:

123 $ git --versiongit version 2.4.9(Apple Git-60)

If you use GitHub, it is recommended that you install a GitHub Desktop again.

IntelliJ

In general, Iintellij is my favorite IDE, mainly because front-end development requires almost the same functionality. To install it, go to the download page and follow the instructions to install:

Installation Instructions

    • Download the IDEA-15.DMG OS x disk image file.
    • Mount it as another disk in the system.
    • Copy IntelliJ idea to the app folder.
Other Nodejs

node. js is the JavaScript runtime built on Chrome on the V8 JavaScript engine. node. JS uses event-driven, lightweight and efficient non-blocking I/O models. node. js's ecosystem package, NPM, is the largest ecosystem of open source libraries in the world. Recently it has become an essential tool in the front-end part of the development process.

Go to https://nodejs.org/to download the latest version of OS X (x64). Double-click the node-v4.2.2.pkg file (the most recent stable version before writing this article) and follow the installation instructions.

When you open a terminal window, check the installed version to see if it works:

123 $ node --versionv4.2.2
Terminal window background Set black

Open terminal, to Terminal menu, Preferences, select the Settings option and set Protheme as default.

To quickly test if everything was OK, I generated a common Unix Keys on German/swiss keyboard.

I bought Mac book as my development machine on the road, and at first I was surprised that there was no key for developers/end users, such as []| {}~

So here, I've listed the Mac OS x keyboard mapping tips I used:

| Pipe symbol <alt>7
Backslash <alt><shift>7 = <alt>/
[ Left (opening) square bracket <alt>5
] Right (closing) square bracket <alt>6
{ Left (opening) Curly Bracket <alt>8
} Right (closing) Curly Bracket <alt>9
~ Tilde <alt>n followed by the space key
@ "At" Symbol <alt>g (Lowercase G)
How to test everything OK

Smoke test (Note: Smoke testing is a simple test of the system function, emphasizing the coverage of the function, not verifying the correctness of the function) can verify that all the installed tools are functionally coordinated, it uses Jhipster to generate an application and update to the GIT repository.

Jhipster is a Yeoman generator that used to create a Spring Boot + AngularJS project.

QQ group 290551701 gathers a lot of Internet elite, technical director, architect, project Manager! Open source technology research, Welcome to the industry, Daniel and beginners are interested in engaging in IT industry personnel to enter!

Setting up the Java development environment on the MacBook Pro

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.