Luckily enough MacOSX (Lion or previous flavors) have still lots of important tools for java development, integrated and ready to use. The main 3 tools usually needed are the following.
- Java (of course) – it is not pre installed by default. All you need to do is open the Terminal.app and type something like java -version. Then a pop-up will appear asking you to install the latest available run time (at the time being is still Java 6)
- Apache Ant – is already pre-installed! (1.8.2 at the time being – Lion 10.7.1)
- Apache Maven – is already pre- installed. (3.0.3 at the time being – Lion 10.7.1)
So all the basic tools are there – all you need to do is set-up the enviroment by defining the HOME variables usually needed by other tools like IDE, app servers etc.
All you have to do is create a special file on your home folder and use some basic script commands like export – to indicate the paths of the tools. Really easy.
1.Go to your home folder, that would be something like
In my system that would be
2.Create a new file using vi or vim (or whatever you like) with the following command
3.Using (vim) in the file – just add the following lines
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home export ANT_HOME=/usr/share/ant/ export MAVEN_HOME=/usr/share/maven/
4.Save the file (vi -> press Esc and :w) (see vi basic commands here)
5.Ready, open a new Terminal tab or window and test if your enviroment variables are all set by typing
echo $JAVA_HOME echo $ANT_HOME echo $MAVEN_HOME
This is it your enviroment variables are ready, MacOSX has already integrated Java, Ant and Maven executables to the system path.
Some paths may change in the future – you can always check where each tool is pre-installed by using the ‘which‘ and ‘ls -al’ command.
So if you are wondering where Ant has gone just type the following
Which is going to return something like /usr/bin/ant
Then just use the path above and use ls to see the real path of the symbolic link
ls -al /usr/bin/ant
This is going to return something like 22 Jul 30 19:38 /usr/bin/ant /usr/share/ant/bin/ant
Hope that helps! Enjoy!
Reference: Setup JAVA_HOME, MAVEN_HOME, ANT_HOME in MacOSX Lion in 5 minutes from our JCG partner Paris Apostolopoulos at the Papo’s log blog.
Related Articles :
Java Platform, Enterprise Edition is a widely used platform for enterprise server programming in the Java programming language.
This book covers exciting recipes on securing, tuning and extending enterprise applications using a Java EE 6 implementation.The book starts with the essential changes in Java EE 6. Then they will dive into the implementation of some of the new features of the JPA 2.0 specification, and look at implementing auditing for relational data stores.They will then look into how they can enable security for their software system using Java EE built-in features as well as using the well-known Spring Security framework. They will then look at recipes on testing various Java EE technologies including JPA, EJB, JSF, and Web services.Next they will explore various ways to extend a Java EE environment with the use of additional dynamic languages as well as frameworks.At the end of the book, they will cover managing enterprise application deployment and configuration, and recipes that will help you debug problems and enhance the performance of your applications.