Set the Java Development Environment on macbookpro, macbookpro

Source: Internet
Author: User
Tags install homebrew macbook

Set the Java Development Environment on macbookpro, macbookpro

Okay, I went to the other side of the earth, and because my PC is not there, only one MacBook Pro can be used for development. This article should be seen as an enhanced bookmarkdonet. I have listed all the necessary Installation Tools for the MacBook to achieve its purpose, that is, for Java and later for JavaScript development.

I still have Windows users (XP/7) and Linux (Ubuntu/Mint/Cent OS ). When I was writing this article, I ran OS X Yosemite Version 10.10.5 on my MacBook Pro.

 

JDK

First, install the Java Development Kit (JDK). This is a software development environment for developing Java applications and applets. It includes Java Runtime Environment (JRE), Interpreter/loader (Java), compiler (javac), archive (jar), document Builder (javadoc) and other tools required for Java development.

Download Mac OS X x64. dmg files

  • Java 7
  • Java 8

You can run the/usr/libexec/java_home-v 1.7 command on the terminal to find the JDK installation path:

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/Home Adrians-MacBook-Pro:ama ama$
For example, you need to know this when creating a project in IntelliJ idea. Set JAVA_HOME

JAVA_HOME is just a convention and is usually used for Tomcat, other JavaEE program servers, and tools like Maven that can find the survival location of Java.

In Mac OSx 10.5 and later versions, Apple recommends setting $ JAVA_HOME to the path/usr/libexec/java_homeUnder, just set$JAVA_HOMEExport to file~/. bash_profileOr~/.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 JAVA_HOME in the method specified above, go to Apache Maven downloads, download the .tar.gz or. zip file, and select a folder to decompress it. I put it in the/opt Folder:

1 tar xzvf apache-maven-3.3.3-bin.tar.gz
We recommend that you create a link to Maven for installation. 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/maven export M2=$M2_HOME/bin export PATH=$M2:$PATH

Close the terminal and open a new one. If you want to get the maven version, you should do the following:

12345678910111213 ama$ mvn -version Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T13:57:37+02:00) Maven home: /opt/maven Java version: 1.8.0_65, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS 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 applications on Apple TV, Apple Watch, iPhone, iPad, and Mac, this is a comprehensive set of developer tools. This includes Xcode IDE, simulators, and all the tools and frameworks required to create IOS, watchOS, tvOS, and OS X applications (including GNU Compiler Collection-gcc ).

You can install it as instructed above, but if you don't want to get everything from the installation package, you can install Homebrew ("Homebrew can install programs you don't need but Apple does ."), And run the following command:

123 brew install gcc brew install git

Either way, after Git installation is complete, the initial command git-version shows the installation version:

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

If you use Github, we recommend that you install another Github Desktop.

IntelliJ

Generally, IIntelliJ is my favorite IDE, mainly because the functions required by front-end development are almost the same. To install it, go to the download page and follow the instructions to install it:

Installation Guide

  • Download the disk image file for idea-15.dmg OS X.
  • Attach it to another disk in the system.
  • Copy IntelliJ IDEA to the application folder.
Other NodeJS

Node. js is the JavaScript runtime built on the V8 Javascript Engine on Chrome. Node. js uses event-driven, lightweight and efficient non-blocking I/O models. Node. js's ecosystem package, npm, is the world's largest open source library ecosystem. Recently, it has become a necessary tool for the front-end of the development program.

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

When a terminal window is opened, check the installed version to see if it works:

123 $ node --version v4.2.2
Terminal window background black

Open the terminal and goTerminal menu-> Preferences, Select the Settings option, and set Protheme to default.

To quickly test whether everything is normal, I generated a Common UNIX Keys on German/Swiss Keyboard.

I bought a Mac Book as a development machine on my journey. At first, I was surprised that there were no buttons frequently used by developers/end users, such as [] | {}~

So here I listed the Mac OS x keyboard ing 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> nFollowed by the space key
@ "At" symbol <Alt> g(Lowercase G)
How to test everything

The smoke test (Note: The smoke test is a simple test of system functions, emphasizing the functional coverage rate and not verifying the correctness of the function) can verify whether the functions of all installed tools are coordinated, it uses JHipster to generate an application and update it to the git repository.

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

QQ Group 290551701 has gathered many Internet elites, Technical Directors, architects, and project managers! Open-source technology research, welcome to the industry, Daniel and beginners interested in IT industry personnel!

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.