Spring MVC Fast Tutorial: installation on Mac OS

We will install:

  • Java 8 (not installed by default on Mac OS 10.9 or higher)
  • Maven 3: a build tool, similar to Ant but with better dependency management.
  • Tomcat 8: a Java web server
  • Eclipse: an IDE

Installing Java

  • On the Oracle website, under Java SE Development Kit, select Accept the License Agreement, download the Mac OS X x64 package and install it.

  • In your ~/.bash_profile, set the JAVA_HOME environment variable.
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home"
# change "jdk1.8.0_40.jdk" to the actual folder on your system, which depends on your version of Java.
  • Open a new terminal and test that it's working:
$ java -version
Java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)

Installing Maven

  • On the Apache website, download the Binary zip of the current version.

  • Uncompress and move the folder to a convenient location (for example: ~/bin).
  • In your ~/.bash_profile, add a MAVEN HOME environment variable pointing to that folder. For example:
export MAVEN_HOME=~/bin/apache-maven-3.3.1
  • Add the bin subfolder to your PATH environment variable:
export PATH=$PATH:$MAVEN_HOME/bin
  • Open a new terminal and test that it's working:
$ mvn –v
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T09:29:23-08:00)
Maven home: /Users/jlj7/bin/apache-maven-3.2.5
Java version: 1.8.0_40, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.9.5", arch: "x86_64", family: "mac"

Installing Tomcat

  • On the Apache website, under Binary distributions, under Core, download the zip file.

  • Uncompress and move the folder to a convenient location (for example: ~/bin).
  • Make the scripts in the bin subfolder executable:
chmod +x bin/*.sh
  • Launch Tomcat using the catalina.sh script:
$ bin/catalina.sh run
Using CATALINA_BASE: /Users/jerome/bin/apache-tomcat-8.0.20
...
INFO: Server startup in 852 ms

Installing Eclipse

  • On the Eclipse website, choose the Mac OS X 64 Bit version of Eclipse IDE for Java EE Developers (:!: not Eclipse IDE for Java Developers)

  • Uncompress and move the folder to a convenient location (for example: ~/bin).
  • Launch Eclipse by executing the eclipse binary:
./eclipse

Next: Hello, World!
Up: Spring MVC Fast Tutorial

Feedback

Thank you !!

redeyesofangel.tistory.com
Jul 16, 2015
#1
Thanks for writing this. I've worked with J2EE and eclipse for a long time, but always on WinDoz. For some reason, using my MacBook to write code has been kind of intimidating, but I'm gonna plow on through. Your setup guide has helped me get off to a much faster start.
Jeffrey
Jan 22, 2016
#2
crystal clear. thank you.

Feb 18, 2017
#3