Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1218
  • Last Modified:

How to setup ANT & JAVA Home in Ubuntu Linux 64 bit ?

Hi All,

I've successfully installed Java and Ant using apt-get, however when i tried to echo the env. variable, I doesn't give me anything ?

But, i can see some result here:

root@SSV:~# java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)

root@SSV:~# ant
Buildfile: build.xml does not exist!
Build failed

Open in new window

is that working configuration or i shall add it into /etc/environment file like the following ?

root@SSV:~# whereis ant
ant: /usr/bin/ant /usr/share/ant /usr/share/man/man1/ant.1.gz[

root@SSV:~# whereis java
java: /usr/bin/java /etc/java /usr/share/java /usr/share/man/man1/java.1.gz

Open in new window

Any help would be greatly appreciated.

  • 3
  • 2
3 Solutions
I am not sure what you are expecting to see in the env variable.
From your comment, you are trying to build a project but ant cannot find the build.xml file. This has nothing to do with the env variable.
Try to locate the build.xml file and run the ant command from the folder where the file is located.
You can use the following to locate the file:
  sudo updatedb
  sudo locate build.xml
Your Ant installation is actually working. This is Ant running and telling you that it has nothing to build. To echo an environment variable use


You need to set ANT_HOME to point to the root of your Ant installation.

export ANT_HOME=/your/path/here

Make sure to add ant/bin directory to your path.

To run Ant use

ant build.xml

where build.xml is the name of the build file. This is actually a default name, so it can be skipped (if the file is named build.xml and is in the current directory).

Follow an Ant tutorial (e.g., http://www.roseindia.net/tutorials/ant/) for further steps.

jjozAuthor Commented:
so in this case those two tools i already set and working eventhough they're not listed under the /etc/environment ?
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Ant is apparently working since you are getting a response. To make sure create a simple build file (with a single target with an echo task) and run Ant from the directory where the file resides.

Running 'java -version' will tell you whether Java is set up correctly.
jjozAuthor Commented:
yes both of them seems to be working.

thanks for the clarification man.
jjozAuthor Commented:
thanks man !

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now