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

Posted on 2010-11-12
Last Modified: 2012-05-10
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.

Question by:jjoz
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Assisted Solution

stermeau earned 167 total points
ID: 34120702
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

Assisted Solution

msmolyak earned 333 total points
ID: 34120964
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., for further steps.


Author Comment

ID: 34125667
so in this case those two tools i already set and working eventhough they're not listed under the /etc/environment ?
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!


Accepted Solution

msmolyak earned 333 total points
ID: 34125681
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.

Author Comment

ID: 34125724
yes both of them seems to be working.

thanks for the clarification man.

Author Closing Comment

ID: 34125725
thanks man !

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question