Jan 16 2012

VirtualBox with Gentoo(4)

Category: Miscellaneous,TechnicalIuliana @ 13:58

This post is the not about the virtual machine or Gentoo, is more about setting up the tools that you will use to develop your applications and other good practices.

First, let’s talk more about environment variables. I mentioned in my previous post the JAVA_HOME variable. Most development tools need their environment variables too and they are not set up by Gentoo, so we will have to do this the way I like it, by hand. Every user has in it’s home directory – in /home/[username] (on my machine /home/jules) a file named .bashrc.The good practice is to edit this file by adding the necessary environment variables required by the tool that user will use.

1. Apache Ant

Apache Ant is a Java library and command-line tool whose mission is to drive processes described in build files as targets and extension points dependent upon each other. The main known usage of Ant is the build of Java applications. Ant supplies a number of built-in tasks allowing to compile, assemble, test and run Java applications.

It is easy to use, quite practical and I recommend it for small scale applications. The installation of Ant consists in unpacking the a

rchive, setting the ANT_HOME and adding the bin directory to the environment PATH variable of Gentoo. Also, the bin directory for Java should be added too, we’ll do that too.

To download ant, go to http://ant.apache.org and under Download menu item, there is a Binary Distributions link, click on that. On the frame on the right you will have a set of links which point to current versions of Ant. Download the tar.bz2 archive, you can use Firefox to do that or you can use wget:

# wget http://mirrors.hostingromania.ro/apache.org/ant/binaries/apache-ant-1.8.2-bin.tar.bz2

Then you have to unpack it:

# tar xpf apache-ant-1.8.2-bin.tar.bz2

After unpacking you will have a directory named apache-ant-1.8.2, usually I rename it to ant, because the version is not that important when the update is made by copying the new version content over the old one. You can copy it where you want, I usually leave it in the home directory for the current user. Then we have to set the ANT_HOME environment variable.

# cd ~ (gets you in /home/[username])
# nano -w .bashrc

Add the following lines:

# export ANT_HOME=/home/[username]/ant
# export PATH=${PATH}:${JAVA_HOME}/bin:${ANT_HOME}/bin

Save. (Ctrl+X,Y) Test the new environment variables:

# echo $ANT_HOME
# echo $PATH

Continue reading “VirtualBox with Gentoo(4)”

Tags: , ,