As we’ve become more mobile it’s important to enable our travel work stations to handle a multitude of development environments. Most developers will want to setup a Java SE development kit on their laptop. This is a step-by-step walkthrough outlining the elements necessary to develop Java applications on your iMac, MacBook, or any OS X device.
Step 1 : Install Java Development Kit (JDK)
Java SE Development Kit 8
Download the MAC OS X installation file jdk-Bu121-macosx-x64.dmg (233 MB).
Step 2 : Setup JAVA_HOME Environment Variable
If you’ve never setup a bash profile open up Terminal and enter:
This will take you to the root directory. Then type:
touch .bash_profile to create the new file.
I personally prefer to edit files in Terminal using Vim editor:
When the editor opens, the file should be blank. Press V then I to activate editing and copy and paste the following line into the file:
To exit the editor and save the document press ESC and then type a colon : ( shift + : ) which will bring up a colon : at the bottom of the file. Now type in
wq! and hit ENTER. This will save the .bash_profile file with your new JAVA_HOME entry.
This will reload .bash_profile and update the function we just added.
To check our work type in:
This should display:
You can skip all of step 3 by installing Homebrew.
I recommend installing it as you will need it down the road to install other environments.
To install Homebrew via SSH type the following line into terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Now that you have Homebrew installed you can install Apache Maven:
brew install maven
Check you have Maven installed by entering:
Now you can skip Step 3A and go to Step 3B.
Step 3A : Install Apache Maven
Go to Apache’s Website here: Apache Maven
Then download the source zip archive file apache-maven=3.5.-src.zip found halfway down the page:
Step 3B : Setup Maven Symbolic Link
I recommend making a symbolic link to the Maven installation folder inside of an opt folder by entering the following:
First create the folder name “opt”
Enter the opt folder:
Create a folder named “maven”
Now go back one folder:
Lastly, make a symbolic link inside the maven folder by typing the following:
ln -s ~/apache-maven-3.5.0 ~/opt/maven
Then we will go into our .bach_profile file:
Add the following 3 lines into the file (after our previously added JAVA_HOME line).
export M2_HOME=/path/to/maven export M2=$M2_HOME/bin export PATH=$M2:$PATH
Remember to close the file using
wq! to save changes.
To initialize those changes.
Step 4 : Install GCC and GIT
There are a couple different ways to install Git and the GNU Compiler Collection GCC.
The easiest is to install Homebrew
brew install gcc
brew install git
Grab a brew because this is gonna take some time to install.
Step 5 : Install IntelliJ IDEA
A Java IDE (Integrated Development Environment) is a software application which enables you to easily write and debug Java programs. IntelliJ provides features like syntax highlighting and code completion. Some popular ones include Eclipse, NetBeans, ItelliJ IDEA, JDeveloper and Android Studio.
I’m going to have you install IntelliJ IDEA (418 MB) from their download page
After the zip file has downloaded, unzip it and drag the IntelliJ_IDEA_CE.app file into your Application folder.
You are now technically done! Launch IntelliJ and start developing the next big application.
Here are some extras you can install to add more features to your JAVA development environment.
NodeJS – Download Page
I’m brave so I installed the latest version 7.9.0 but you can choose to install the most stable version 6.10.2 if you feel that suits you better. The difference between the stable and latest version is you may experience issues with the latest version that are due to its current code.