I got the newest version of Ant, 1.6.0, and I setup my ANT_HOME and JAVA_HOME as directed. I downloaded a tutorial as well, to help me get started, however... I am running it on windows xp home edition. When I run 'ant' from the prompt, I get the following... C:\ant>ant Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file) where options include: -client to select the "client" VM -server to select the "server" VM -hotspot is a synonym for the "client" VM [deprecated] The default VM is client. -cp <class search path of directories and zip/jar files> -classpath <class search path of directories and zip/jar files> A ; separated list of directories, JAR archives, and ZIP archives to search for class files. -D<name>=<value> set a system property -verbose[:class|gc|jni] enable verbose output -version print product version and exit -showversion print product version and continue -? -help print this help message -X print help on non-standard options -ea[:<packagename>...|:<classname>] -enableassertions[:<packagename>...|:<classname>] enable assertions -da[:<packagename>...|:<classname>] -disableassertions[:<packagename>...|:<classname>] disable assertions -esa | -enablesystemassertions enable system assertions -dsa | -disablesystemassertions disable system assertions C:\ant> So all ant does it running 'java', accordingly to the tutorial, I should have witnessed something like: Buildfile: build.xml does not exist! Build failed Any clue on what is going wrong? Thanks
Bhushan Jawle
Ranch Hand
Joined: Nov 22, 2001
Posts: 247
posted
0
Ant expects build.xml to be present in the directory where you invoke ant.sh ot ant.bat, hence the message
Michael Jensen
Greenhorn
Joined: Jan 18, 2004
Posts: 5
posted
0
Thanks for the reply but No. You only read the last part of the post. I wish I could get the Build failed message though That would mean it would actually be working. When I run the ant.bat file, all it does it launch the "java" command. It should be looking for the build.xml and run that. I dont know what is going wrong. Here is my ant.bat file: @echo off REM Copyright (c) 2001-2003 The Apache Software Foundation. All rights REM reserved. if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat" if "%OS%"=="Windows_NT" @setlocal rem %~dp0 is expanded pathname of the current script under NT set DEFAULT_ANT_HOME=%~dp0.. if "%ANT_HOME%"=="" set ANT_HOME=%DEFAULT_ANT_HOME% set DEFAULT_ANT_HOME= rem Slurp the command line arguments. This loop allows for an unlimited number rem of arguments (up to the command line limit, anyway). set ANT_CMD_LINE_ARGS=%1 if ""%1""=="""" goto doneStart shift :setupArgs if ""%1""=="""" goto doneStart set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1 shift goto setupArgs rem This label provides a place for the argument list loop to break out rem and for NT handling to skip to. oneStart rem find ANT_HOME if it does not exist due to either an invalid value passed rem by the user or the %0 problem on Windows 9x if exist "%ANT_HOME%\lib\ant.jar" goto checkJava rem check for ant in Program Files if not exist "%ProgramFiles%\ant" goto checkSystemDrive set ANT_HOME=%ProgramFiles%\ant goto checkJava :checkSystemDrive rem check for ant in root directory of system drive if not exist %SystemDrive%\ant\lib\ant.jar goto checkCDrive set ANT_HOME=%SystemDrive%\ant goto checkJava :checkCDrive rem check for ant in C:\ant for Win9X users if not exist C:\ant\lib\ant.jar goto noAntHome set ANT_HOME=C:\ant goto checkJava :noAntHome echo ANT_HOME is set incorrectly or ant could not be located. Please set ANT_HOME. goto end :checkJava set _JAVACMD=%JAVACMD% if "%JAVA_HOME%" == "" goto noJavaHome if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe goto checkJikes :noJavaHome if "%_JAVACMD%" == "" set _JAVACMD=java.exe :checkJikes if not "%JIKESPATH%"=="" goto runAntWithJikes :runAnt if not "%CLASSPATH%"=="" goto runAntWithClasspath "%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS% goto end :runAntWithClasspath "%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -lib "%CLASSPATH%" %ANT_CMD_LINE_ARGS% goto end :runAntWithJikes if not "%CLASSPATH%"=="" goto runAntWithJikesAndClasspath "%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS% goto end :runAntWithJikesAndClasspath "%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -lib "%CLASSPATH%" %ANT_CMD_LINE_ARGS% goto end :end set _JAVACMD= set ANT_CMD_LINE_ARGS= if "%OS%"=="Windows_NT" @endlocal :mainEnd if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat"
[ January 19, 2004: Message edited by: Michael Jensen ] [ January 21, 2004: Message edited by: Paul Stevens ]
Paul Stevens
Ranch Hand
Joined: May 17, 2001
Posts: 2823
posted
0
You are sure they are both set correctly? What does it show when you type set from the command prompt for those?
Try moving c:\ant\bin to the front of your Path. Maybe there is something else named ant on your path. I can't think of what else would do this. I have tried multiple things and always get the build.xml does not exist.
Michael Jensen
Greenhorn
Joined: Jan 18, 2004
Posts: 5
posted
0
That did not help However, I installed quicktime today, and after I did that. I got another err. QTJava unexpected at this time. Weird.
Michael Jensen
Greenhorn
Joined: Jan 18, 2004
Posts: 5
posted
0
Ok, I finally got it fixed. Stupid stupid First... when I installed Java, it put the QTjava.zip into the classpath for some reason. Ant didnt like that, so i moved around a little bit. That worked then. Ok, the first mentioned problem came because my Ant_home was: c:\ant\ instead of c:\ant Which made the ant.bat script do c:\ant\\.... So it terminated and just launched the "java" Anyway, thanks for your replies guys
Paul Stevens
Ranch Hand
Joined: May 17, 2001
Posts: 2823
posted
0
And you even posted what the set command showed. Nobody else saw that either. Thanks for posting the result. Anyone else has a similar problem and they can see what to look for.
K Man
Greenhorn
Joined: Apr 15, 2004
Posts: 10
posted
0
Michael, You are awesome! I was getting that same QTJava.zip unexpected error msg. I just copied what you did for your System variables and now it works. also i had that trailing '\' for my ANT_HOme dir which I removed. Thanks, -Krishna