• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 506
  • Last Modified:

Help installing ANT

looking for some help to install ANT - getting error messages im not sure about:


C:\Program Files\Java\apache-ant-1.6.5>build.bat

... Bootstrapping Ant Distribution
JAVA_HOME=
JAVA=java
JAVAC=javac
CLASSPATH=lib\xercesImpl.jar;lib\xml-apis.jar;build\classes;src\main;

... Compiling Ant Classes
'"javac"' is not recognized as an internal or external command,
operable program or batch file.

... Copying Required Files
src\main\org\apache\tools\ant\taskdefs\defaults.properties
The system cannot find the path specified.
        0 file(s) copied.
src\main\org\apache\tools\ant\types\defaults.properties
The system cannot find the path specified.
        0 file(s) copied.

... Building Ant Distribution
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/
Main

... Cleaning Up Build Directories

... Done Bootstrapping Ant Distribution
Bootstrap FAILED
C:\Program Files\Java\apache-ant-1.6.5>



NetBeans 5 installed in: C:\Program Files\netbeans-5.0
JDK1.5 installed in: C:\Program Files\Java\jdk1.5.0_06
Downloaded ANT and exists currently in: C:\Program Files\Java\apache-ant-1.6.5
JRE installed in: C:\Program Files\Java\jre1.5.0_06

first of all i did read the setup and i didnt see anywhere on where to install ANT so as i said above, im not sure how to continue...
0
ellandrd
Asked:
ellandrd
  • 11
  • 9
  • 5
10 Solutions
 
objectsCommented:
set JAVA_HOME environment variable to point to where you have the jdk installed - C:\Program Files\Java\jdk1.5.0_06


http://www.helpwithwindows.com/WindowsXP/howto-04.html
0
 
CEHJCommented:
You need to set Java's bin directory in your PATH. Good to create env var ANT_HOME too. Set that to Ant install dir and then add %ANT_HOME%\bin to PATH too
0
 
ellandrdAuthor Commented:
when i edit the PATH, do i just add the line:

set ANT_HOME=C:\Program Files\Java\Ant

?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
objectsCommented:
you do *not* need to edit your PATH.
In fact you shouldn't even need to build it. Did u download a binary distribution?

http://ant.apache.org/bindownload.cgi

soem details on installing:

http://ant.apache.org/manual/install.html#installing

and if u do need to build it:

http://ant.apache.org/manual/install.html#buildingant
0
 
CEHJCommented:
No you append

;%JAVA_HOME%\bin

(if you've set JAVA_HOME), else

;C:\Program Files\Java\jdk1.5.0_06\bin

Also append

;%ANT_HOME%\bin

(obviously after having set ANT_HOME)
0
 
ellandrdAuthor Commented:
yes i downloaded the binary dist.

i will take a look at this URL's..
0
 
objectsCommented:
Then you don't need to build.

Just follow the install instruction I posted above
the earlier link shows u how to set the environment vars.
0
 
ellandrdAuthor Commented:
>>build -Ddist.dir=<directory_to_contain_Ant_distribution> dist

this is:

build -Ddist.dir=C:\Program Files\Java\Ant dist

?

(i have Ant extracted into: C:\Program Files\Java\Ant...)
0
 
ellandrdAuthor Commented:
i have also added: ";C:\Program Files\Java\jdk1.5.0_06\bin" to my PATH as it was not there...

0
 
objectsCommented:
> build -Ddist.dir=C:\Program Files\Java\Ant dist

you don't need to build, its already built :)

> i have also added: ";C:\Program Files\Java\jdk1.5.0_06\bin" to my PATH as it was not there...

thats also not needed

you want to instead add C:\Program Files\Java\Ant\bin to your path
0
 
ellandrdAuthor Commented:
OK objects i have just extracted the binary dist into c:\program files\java\ant

i now have th eset set up as in the installation guide... bin, libs etc etc.

in DOS, when i run ANT.bat (C:\Program Files\Java\Ant\bin\ant.bat)

i get this:

C:\Program Files\Java\Ant\bin>ant
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre1.5.
0_06\lib\tools.jar
Buildfile: build.xml does not exist!
Build failed
C:\Program Files\Java\Ant\bin>

0
 
objectsCommented:
java_home should be set to C:\Program Files\Java\jdk1.5.0_06
0
 
CEHJCommented:
>>i have also added: ";C:\Program Files\Java\jdk1.5.0_06\bin" to my PATH as it was not there...

It is actually better to have

%JAVA_HOME%\bin

but either way, Ant will now be able to find javac. For a Java developer such as yourself, not to have Java on your path would be a strange thing and you should not totally rely on any IDE. Having Ant on your path will mean you can run Ant from anywhere
0
 
ellandrdAuthor Commented:
ive opened a new question on how to set to set JAVA_HOME as this issue isnt aprt of this installing ANT topic..

http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21867755.html

I wouldnt call myself a java developer.  you guys have helped me with stuff over the last year while i learn java on my own and there is still loads i dont know in terms of setting up java environment...
0
 
ellandrdAuthor Commented:
OK i now get build.xml file dont exist... but there was never a build.xml file that came with my binary download...
0
 
objectsCommented:
Its up to you to create a build.xml
it is the script that tells ant how/what to build in your project

http://ant.apache.org/manual/usinglist.html
0
 
CEHJCommented:
>>OK i now get build.xml file dont exist...

What are you doing when that happens?
0
 
ellandrdAuthor Commented:
>>its up to you to create a build.xml
>>it is the script that tells ant how/what to build in your project

right OK - i have done this before for netbeans... i though there might be a default build.xml file that came in the dist...

fair enough i will build my own simple build.xml file...

so is that it then?
0
 
ellandrdAuthor Commented:
do i place my build.xml file in %ANT_HOME% or %ANT_HOME%\bin ?
0
 
objectsCommented:
thats all there is to it, keep the ant doco handy as a good reference :)

let me know if you need anymore help.
0
 
objectsCommented:
> do i place my build.xml file in %ANT_HOME% or %ANT_HOME%\bin ?

no, it should go with your project

by default ant looks for it in the current directory, or you can specify with the -buildfile option
0
 
ellandrdAuthor Commented:
>>let me know if you need anymore help.

thanks to both of you!!

i think that it pretty much sorted and set up now..

i do have one more question to ask but it will be another question as usual... it will be about using a keytool to create a "never expire" JAR file
0
 
objectsCommented:
> i do have one more question to ask but it will be another question as usual... it will be about using a keytool to create a "never expire" JAR file

cannot be done sorry
0
 
CEHJCommented:
:-)
0
 
ellandrdAuthor Commented:
well at least set it to like 50 years like CEHJ has already suggested... ;-)
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 11
  • 9
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now