Hi all,
I am getting the following message when I try to run ant command,
The name specified is not recognized as an internal or external command, operable program or batch file
.I am running the ant on windows.
I have set the environment variables ANT_HOME,JAVA_HOME and the classpath properly. I have set the ant.jar, jaxp.jar and parser.jar in the classpath.
I am running the ant at the location where build.xml file is residing. the build.xml file looks like this
<project name="otcapp" default="all" basedir=".">
<!-- set global properties for this build -->
<property name="src" value="./java" />
<property name="build" value="build" />
<property name="dist" value="dist" />
<property name="lib" value="./lib" />
<property name="log4j" value="./lib" />
<property name="jspdir" value="./jsp" />
<property name="config" value="./config" />
<property name="propdir" value="./properties" />
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}" />
</target>
<target name="prepare" depends="init">
<mkdir dir="${build}/jsp" />
<mkdir dir="${build}/WEB-INF" />
<mkdir dir="${build}/WEB-INF/lib" />
<mkdir dir="${build}/WEB-INF/classes" />
<mkdir dir="${dist}" />
</target>
<target name="compile" depends="prepare">
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}/WEB-INF/classes" classpath="${lib}/fscontext.jar;${lib}/jndi.jar;${lib}/providerutil.jar;${lib}/ifxjdbcx.jar;${lib}/ifxsqlj.jar;${lib}/jdbc2_0-stdext.jar;${lib}/ifxjdbc.jar;${lib}/rowset.jar;${lib}/log4j.jar"/>
</target>
<target name="copy-jsp-dir" depends="prepare">
<copy todir="${build}/jsp">
<fileset dir="${jspdir}"/>
</copy>
</target>
<target name="copy-lib-dir" depends="prepare">
<copy todir="${build}/WEB-INF/lib">
<fileset dir="${lib}"/>
</copy>
</target>
<target name="copy-webconfig-dir" depends="prepare">
<copy todir="${build}/WEB-INF">
<fileset dir="${propdir}"/>
</copy>
<copy file="${config}/web.xml" todir="${build}/WEB-INF" />
</target>
<target name="build-jar" depends="compile,copy-jsp-dir,copy-lib-dir,copy-webconfig-dir">
<!-- Put everything in ${build} into the PinkAppServer-${DSTAMP}.jar file -->
<jar jarfile="${dist}/otcapp.war" basedir="${build}" />
</target>
<target name="clean">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}" />
</target>
<target name="all" depends="build-jar, clean" />
</project>
and my ant.bat file looks like this
@echo off
if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat"
if not "%OS%"=="Windows_NT" goto win9xStart
:winNTStart
@setlocal
rem %~dp0 is name of current script under NT
set DEFAULT_ANT_HOME=%~dp0
rem : operator works similar to make : operator
set DEFAULT_ANT_HOME=%DEFAULT_ANT_HOME:\bin\=%
if %ANT_HOME%a==a set ANT_HOME=%DEFAULT_ANT_HOME%
set DEFAULT_ANT_HOME=
rem On NT/2K grab all arguments at once
set ANT_CMD_LINE_ARGS=%*
goto doneStart
:win9xStart
rem Slurp the command line arguments. This loop allows for an unlimited number of
rem agruments (up to the command line limit, anyway).
set ANT_CMD_LINE_ARGS=
:setupArgs
if %1a==a goto doneStart
set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
shift
goto setupArgs
:doneStart
rem This label provides a place for the argument list loop to break out
rem and for NT handling to skip to.
rem find ANT_HOME
if not "%ANT_HOME%"=="" goto checkJava
rem check for ant in Program Files on system drive
if not exist "%SystemDrive%\Program Files\ant" goto checkSystemDrive
set ANT_HOME=%SystemDrive%\Program Files\ant
goto checkJava
:checkSystemDrive
rem check for ant in root directory of system drive
if not exist "%SystemDrive%\ant" goto noAntHome
set ANT_HOME=%SystemDrive%\ant
goto checkJava
:noAntHome
echo ANT_HOME is not set and ant could not be located. Please set ANT_HOME.
goto end
:checkJava
set _JAVACMD=%JAVACMD%
set LOCALCLASSPATH=%CLASSPATH%
for %%i in ("%ANT_HOME%\lib\*.jar") do call "%ANT_HOME%\bin\lcp.bat" "%%i"
if "%JAVA_HOME%" == "" goto noJavaHome
if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java
if exist "%JAVA_HOME%\lib\tools.jar" call "%ANT_HOME%\bin\lcp.bat" "%JAVA_HOME%\lib\tools.jar"
if exist "%JAVA_HOME%\lib\classes.zip" call "%ANT_HOME%\bin\lcp.bat" "%JAVA_HOME%\lib\classes.zip"
goto checkJikes
:noJavaHome
if "%_JAVACMD%" == "" set _JAVACMD=java
echo.
echo Warning: JAVA_HOME environment variable is not set.
echo If build fails because sun.* classes could not be found
echo you will need to set the JAVA_HOME environment variable
echo to the installation directory of java.
echo.
:checkJikes
if not "%JIKESPATH%" == "" goto runAntWithJikes
:runAnt
%_JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" %ANT_OPTS% org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS%
goto end
:runAntWithJikes
%_JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" -Djikes.class.path=%JIKESPATH% %ANT_OPTS% org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS%
:end
set LOCALCLASSPATH=
set _JAVACMD=
set ANT_CMD_LINE_ARGS=
if not "%OS%"=="Windows_NT" goto mainEnd
:winNTend
@endlocal
:mainEnd
if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat"
Greatly appreciate your help in this regard.
Thanks,
dinesh