Browse Source

Allow the use of the JAVACMD environment variable in ant.bat to modify

how ant's JVM is invoked.

This aligns ant.bat with the ant shell script version.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267701 13f79535-47bb-0310-9956-ffa450edef68
master
Conor MacNeill 25 years ago
parent
commit
90ec391053
1 changed files with 7 additions and 5 deletions
  1. +7
    -5
      src/bin/ant.bat

+ 7
- 5
src/bin/ant.bat View File

@@ -1,31 +1,33 @@
@echo off @echo off
@setlocal @setlocal
if "%ANT_HOME%"=="" goto checkProgFiles if "%ANT_HOME%"=="" goto checkProgFiles
goto checkJavaHome
goto checkJava


:checkProgFiles :checkProgFiles
rem check for ant on system drive rem check for ant on system drive
if not exist "%SystemDrive%\Program Files\ant" goto checkSystemDrive if not exist "%SystemDrive%\Program Files\ant" goto checkSystemDrive


set ANT_HOME=%SystemDrive%\Program Files\ant set ANT_HOME=%SystemDrive%\Program Files\ant
goto checkJavaHome
goto checkJava


:checkSystemDrive :checkSystemDrive
if not exist "%SystemDrive%\ant" goto noAntHome if not exist "%SystemDrive%\ant" goto noAntHome
set ANT_HOME=%SystemDrive%\ant set ANT_HOME=%SystemDrive%\ant
goto checkJavaHome
goto checkJava


:noAntHome :noAntHome
echo ANT_HOME is not set and ant could not be located echo ANT_HOME is not set and ant could not be located
goto end goto end


:checkJavaHome
:checkJava
if "%JAVACMD%" == "" set JAVACMD=java

if "%JAVA_HOME%" == "" goto runAnt if "%JAVA_HOME%" == "" goto runAnt
set CLASSPATH=%JAVA_HOME%\lib\tools.jar;%CLASSPATH% set CLASSPATH=%JAVA_HOME%\lib\tools.jar;%CLASSPATH%


:runAnt :runAnt
set CLASSPATH=%ANT_HOME%\lib\ant.jar;%ANT_HOME%\lib\xml.jar;%CLASSPATH% set CLASSPATH=%ANT_HOME%\lib\ant.jar;%ANT_HOME%\lib\xml.jar;%CLASSPATH%
java -Dant.home="%ANT_HOME%" org.apache.tools.ant.Main %1 %2 %3 %4 %5 %6 %7 %8 %9
%JAVACMD% -Dant.home="%ANT_HOME%" org.apache.tools.ant.Main %1 %2 %3 %4 %5 %6 %7 %8 %9


:end :end
@endlocal @endlocal

Loading…
Cancel
Save