LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-12-2010, 02:49 AM   #1
albertwt
Member
 
Registered: Aug 2010
Posts: 50

Rep: Reputation: 1
Question 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:
Quote:
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 ?

Quote:
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
root@SSV:~#
Any help would be greatly appreciated.

Thanks,

Albert
 
Old 11-12-2010, 10:51 PM   #2
crabboy
Moderator
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,823

Rep: Reputation: 120Reputation: 120
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.

test1.java
Code:
class test1
{
   public void main()
   {
      System.out.println("Hello");
   }
}
build.xml
Code:
<?xml version="1.0"?>

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

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

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

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

</project>
 
1 members found this post helpful.
Old 11-12-2010, 11:08 PM   #3
albertwt
Member
 
Registered: Aug 2010
Posts: 50

Original Poster
Rep: Reputation: 1
wow, thank you very much man, I learn so much with this way.
 
  


Reply

Tags
ant, environment variable, java, ubuntu


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I set up Ant JosephS Slackware 1 09-01-2008 01:34 PM
how to set up path,classpath,catalina home for java in fedora -9 vicky7038 Linux - Software 1 08-19-2008 08:41 AM
ant limewire and java kevner Slackware 3 06-29-2005 07:48 AM
Ant & args for java acjt Programming 1 04-25-2004 12:01 AM
java ant tomcat j-ray Linux - Software 1 09-12-2002 11:59 AM


All times are GMT -5. The time now is 02:24 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration