Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-11-12
6
Medium Priority
?
1,204 Views
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
root@SSV:~#

Open in new window


Any help would be greatly appreciated.

Thanks
0
Comment
Question by:jjoz
  • 3
  • 2
6 Comments
 
LVL 5

Assisted Solution

by:stermeau
stermeau earned 668 total points
ID: 34120702
Hi,
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
0
 
LVL 5

Assisted Solution

by:msmolyak
msmolyak earned 1332 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

echo $JAVA_HOME

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.

Michael
0
 
LVL 1

Author Comment

by:jjoz
ID: 34125667
so in this case those two tools i already set and working eventhough they're not listed under the /etc/environment ?
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
LVL 5

Accepted Solution

by:
msmolyak earned 1332 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.
0
 
LVL 1

Author Comment

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

thanks for the clarification man.
0
 
LVL 1

Author Closing Comment

by:jjoz
ID: 34125725
thanks man !
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
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.
Suggested Courses
Course of the Month13 days, 1 hour left to enroll

972 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