rioastamal.net

Just things inside my head…

Tutorial: How to Install Apache Ant on Ubuntu Linux

Posted by rio On October - 14 - 2008

Sorry if there are any spelling or grammatical errors, I’m learning English… :)

On my last article I’ve show you how to install Java Development Kit(JDK) on Ubuntu Linux. In this tutorial we will try to install Apache Ant or Ant in short. Before going more deeper, some of you may ask, What is ant?

Apache Ant is a software tool for automating software build processes. It is similar to make but is implemented using the Java language, requires the Java platform, and is best suited to building Java projects.

If you ever try building some application from source in Linux, I bet you have used build tool called make. Ant is very similar to it but Ant use XML based configuration for it’s build process. Ant is also used internally by NetBeans IDE to compile project. OK, enough talk let’s install Ant.

My Environment

  • My $HOME is located in /home/astadev
  • I put Ant package in $HOME/archive/a
  • I extract the package to $HOME/programs
  • My Ant version is 1.7.1

Pre-Installation
You must have Java installed first, go to my Java installation tutorial if you have not install Java yet.

Installation
Download the latest version of Ant from http://ant.apache.org. Saved to some location e.g: I save to $HOME/archive. First we need to extract the package.

$ tar -jxvf ~/archive/a/apache-ant-1.7.1-bin.tar.bz2 -C ~/programs
$ cd programs
$ ln -s apache-ant-1.7.1 ant

Note: if your ant package in .gz format use -zxvf instead.

The next step is to add Apache Ant directory to shell environment variables. So we need to edit .bashrc file located in our home directory.

$ gedit ~/.bashrc

Put this at the end of .bashrc file, after editing your file look something like this:

JAVA_HOME=/usr/local/java
JAVA_BIN=$JAVA_HOME/bin
ANT_HOME=/home/astadev/programs/ant
PATH=$PATH:$JAVA_HOME:$JAVA_BIN:$ANT_HOME/bin
export PATH

Save the file, and then open new bash session by pressing CTRL-Shift-T. Try to execute ant.

$ ant
Buildfile: build.xml does not exist!
Build failed

Error? No. Error above indicate that ant command is recognized by shell but it did not find build.xml file that needed to compile ant projects. So, it’s absolutely normal and the installation was successful.

Comment and feedback are welcome :).

References:
http://ant.apache.org/
http://en.wikipedia.org/wiki/Apache_Ant

bookmark bookmark bookmark bookmark bookmark bookmark

  1. Edi Psw Said,

    Wah, bisa dipraktekkan di Ubuntu-ku nih.

  2. rio Said,

    @Pak Edi, hehe… pasti bisa dong pak… :)

  3. mbahsomo Said,

    Gimana Mas Rio Lokasi dimana Surabaya Juga Kan

  4. Edi Psw Said,

    Saya tunggu lagi tutorial berikutnya ya?

  5. Sutrisno Said,

    Wah menarik sekali isi blognya….

    Terus maju mas… Share ilmu di blog…

    Sutrisno
    http://jawagame.blogspot.com

  6. Sherri Grant Said,

    a7v1gx3mr0iw2syu

  7. Allison Sellers Said,

    I am not sure I totally agree with you, but it is well stated. Keep up the good work.

  8. rioastamal.net » Blog Archive » Tutorial: How to Install Google Android SDK on Ubuntu Linux Said,

    [...] How to Install Apache Ant on Ubuntu Linux [...]

  9. Dagu Said,

    It works! tx a lot.

  10. rio Said,

    @dagu.

    you’re welcome, glad to see it works for you :)

  11. Agung Wiseso Said,

    hello, my name is agung wiseso, can you help me? Pk bahasa indonesia aja ya.. hehehehe…
    saya sudah menginstall java secara manual, letaknya di /usr/share/java1.6. (sukses)

    JAVA_HOME=/usr/share/jdk1.6.0_16
    export JAVA_HOME
    PATH=$JAVA_HOME/bin:$PATH
    export PATH

    kemudian saya install apache ant 1.7.
    saya taruh di /usr/local/apache-ant-1.7. (format .gz) sesuai rekomendasi anda, saya menggunakan tar -zxvf ….

    pada setting bashrc nya bingung, kira-kira gmna setting nya?

    tolong ya…

Add A Comment