Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-30-2008, 01:20 AM
Member
 
Join Date: Nov 2007
Posts: 50
sireesha is on a distinguished road
Problem in running ant
Hi Every One,
I am new to ant.To learn ant,i am following some online tutorials.when i tried to run ant from command prompt i got some errors.Here is my problem..

I have created a simple directory structure like
TestAnt
l
-->src-->HelloWorld.java
l
--> build.xml

When i tried to run ant from command prompt result was like this

Code:
E:\WINDOWS\java\TestAnt>ant Unable to locate tools.jar. Expected to find it in E:\Program Files\Java\jre1.6.0_05\lib\tools.jar Buildfile: build.xml init: compile: [javac] Compiling 1 source file to E:\WINDOWS\java\TestAnt\build BUILD FAILED E:\WINDOWS\java\TestAnt\build.xml:20: Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK. It is currently set to "E:\Program Files\Java\jre1.6.0_05" Total time: 0 seconds
and my environment variable values are
Code:
path=E:\oraclexe\app\oracle\product\10.2.0\server\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;E:\WINDOWS\jdk6\bin;C:\apache-ant-1.7.0-bin\bin; JAVA_HOME=E:\WINDOWS\jdk6\bin;E:WINDOWS\jdk6 ANT_HOME=C:\apache-ant-1.7.0-bin
Is there any mistake in my environment variables ?

My JAVA_HOME value is

Code:
E:\WINDOWS\jdk6\bin;E:WINDOWS\jdk6
But when i am running ant i got message like
Code:
Perhaps JAVA_HOME does not point to the JDK. It is currently set to "E:\Program Files\Java\jre1.6.0_05"
Can any one please tell me what's wrong with this..


Thank q very much,
Sireesha.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-30-2008, 09:49 AM
Senior Member
 
Join Date: Jun 2007
Location: Bali, ID
Posts: 102
wsaryada is on a distinguished road
Instead of JRE you should also have the JDK on your computer. JRE doesn't come with the javac command. Have you install the JDK?
__________________
Website:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
- Blog:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-30-2008, 10:14 AM
Member
 
Join Date: May 2008
Posts: 5
naresh_m is on a distinguished road
Hi sireesha,
u have to the PATH variable as E:\Program Files\Java\jre1.6.0_05
and
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 05-30-2008, 10:20 AM
Member
 
Join Date: May 2008
Posts: 5
naresh_m is on a distinguished road
Hi sireesha,
u have to set the the PATH variable as E:\Program Files\Java\jre1.6.0_05\bin
in envronment variable and CLASSPATH variable as C:\Program Files\Java\jdk1.5.0_15\lib\tools.jar; ok
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 05-30-2008, 08:10 PM
Member
 
Join Date: Nov 2007
Posts: 50
sireesha is on a distinguished road
Hi,
Thank q very much for your replies ,I changed both path and classpath variables .Now this time i got a message like build successful.
But i am still getting message like Unable to locate tools.jar.
But this time my java class is compiled so i am happy.But i took this example from a site.So i didn't understand code written in build.xml.My build.xml file is
Code:
<project name="TestAnt" default="dist" basedir="."> <description> simple example build file </description> <!-- set global properties for this build --> <property name="src" location="src"/> <property name="build" location="build"/> <property name="dist" location="dist"/> <target name="init"> <!-- Create the time stamp --> <tstamp/> <!-- Create the build directory structure used by compile --> <mkdir dir="${build}"/> </target> <target name="compile" depends="init" description="compile the source " > <!-- Compile the java code from ${src} into ${build} --> <javac srcdir="${src}" destdir="${build}"/> </target> <target name="dist" depends="compile" description="generate the distribution" > <!-- Create the distribution directory --> <mkdir dir="${dist}/lib"/> <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file --> <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/> </target> <target name="clean" description="clean up" > <!-- Delete the ${build} and ${dist} directory trees --> <delete dir="${build}"/> <delete dir="${dist}"/> </target> </project>
Can any one please explain me what is use of this build.xml and different terms in this file..

and aslo

Can any please tell me how to use this build.xml ( or ant) in case of web applications.


I am really confused with using ant.I read different tutorials but i couldn't understand properly.I need some explanation..Please anybody give me some explanation in this topic...

Thank q very much,
sireesha.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem while running web service client krsv36 Other IDEs 0 05-15-2008 07:12 PM
jsp running problem bharanikumariyerjava JavaServer Pages (JSP) and JSTL 1 03-29-2008 12:48 PM
problem while running java code.. Jjava New To Java 0 02-08-2008 08:33 AM
Running a plug-in JavaForums Java Blogs 0 01-29-2008 02:30 PM
Running a system ai_2007 Advanced Java 1 06-29-2007 05:16 PM


All times are GMT +3. The time now is 12:03 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org