-   Linux - Newbie (
-   -   How to set Ant and Java Home ? (

albertwt 11-12-2010 03:49 AM

How to set Ant and Java Home ?
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
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
Any help would be greatly appreciated.



crabboy 11-12-2010 11:51 PM

You may want to set the ANT_HOME and JAVA_HOME environment variables, but other that than it looks like it is working.

You can always test it out, put both files in a directory and run ant.

class test1
  public void main()


<?xml version="1.0"?>

<project name="test1" default="all">

        <target name="compile">
                <echo message="Compiling..."/>
                <javac srcdir="." destdir="." includes="" />

        <target name="all" depends="clean,compile"/>

        <target name="clean">
                <echo message="Cleaning..."/>
                <delete failonerror="false">
                        <fileset dir="." includes="test1.class"/>


albertwt 11-13-2010 12:08 AM

wow, thank you very much man, I learn so much with this way.

All times are GMT -5. The time now is 04:50 AM.