Wednesday, December 25, 2013

Setup your Java development environment in your new Mac in 10 minutes (updated) (java, ant, maven, gradle) #setup #mac #java

This is just a small update post that references 2 older entries (a, b) , I just combine them in one, like an one step procedure plus making sure that everything works under the latest at the time being MacOSX 10.9 Mavericks. I am mostly targeting inexperienced or junior programmers trying to setup their environment for the first time. So you just got your shinny new Mac and you are ready for some java development, excellent, lets get started it is fairly easy!  I am going to split the whole thing into 3 simple steps, the only think you need to provide is the folder paths, you can select your own installation directories.

Step 1: Download the packages

Step 2: Install or extract the packages

The Java 6 and Java 7,8 downloads are in a dmg form so you just double click them and install them, the setup wizard is fairly easy. Nothing extra or magic required.

 For the Ant, Maven and Gradle packages you  need to extract them at a folder of your choice, it is really up to you. So unzip them and if you like rename the unzipped folders, giving them a simple name. My path of choice was /Volumes/secondary/libs

So I extracted and renamed them as follows:
  • /Volumes/secondary/libs/ant
  • /Volumes/secondary/libs/maven
  • /Volumes/secondary/libs/gradle

Step 3: Modify your .profile

Open up your terminal navigate to your home profile, usually when you open app the application is already on your home folder if not just to it  cd  /Users/your_user_name , for me it is /Users/papo
and type
 vi .bash_profile
This will open the vi editor. All you need to do is copy paste the following entries, MAKING SURE that the paths are correct for you. I assume that you already know the basic vi modes (Esc+i=insert mode, Esc+w=write mode, Esc+q=quite).

 Save your .bash_profile and exit the terminal. Open a new One in order the changes to take effect.


Now you can test your new path environment, type java -version to check that indeed java 7 is the one loaded currently or type java6 so that Java 6 becomes active.

Type ant -version, mvn -version or gradle to check that the tools are available from your command line.

You are done. If you are looking for a nice Java IDE to start coding then head for Eclipse and Netbeans. The latter is more suitable for junior programmers. Both of them are very very powerfull and they provide rich functionality.

Happy coding.


  1. Replies
    1. You can actually not install it at all. Simple as that.

  2. This comment has been removed by a blog administrator.

  3. Thanks for the post! I did note that my java_home didn't know about 1.7 until I installed the JDK. The install of the JRE that you linked above was not sufficient.

    1. Correct, my mistake, I have provided the link for the JRE, I meant JDK. I have fixed the link to point on the JDK download page

  4. Recently, I bought a mac air book and try to install java. as i am new to Mac OS, myself totally fedup. lastly, i landed ion your blog and it gives clear about installing Java development platform in Mac OS fast.

  5. Wonderful blog & good post.Its really helpful for me, awaiting for more new post. Keep Blogging!

    JAVA Training Institutes in Chennai

  6. This comment has been removed by the author.

  7. Hi, This is Jamuna from Chennai. I have read your blog and I got some knowledgeable information through this blog. Really useful blog. Keep update your blog.

    Java Training in Chennai