Following on Newtopian's suggestions, you can quickly confirm if that behavior is the problem by running in the terminal
C:\>set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_19
C:\>ant debug
Also, I'm not sure if the text you entered into the JAVA_HOME environment variable is literally "C:\Program Files\Java\jdk1.6.0_19", i.e., with quotes, but if so, you should remove the quote marks as they'll throw off ant.bat.
Here's the relevant bit from ant.bat
: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
... omitted ...
"%_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%
If that doesn't help, could you post your debug task?
Two options to make it permanent:
Run this:
C:\>REG delete HKCU\Environment /V JAVA_HOME
C:\>REG delete HKLM\Environment /V JAVA_HOME
C:\>REG add HKCU\Environment /V JAVA_HOME /d "C:\Program Files\Java\jdk1.6.0_19"
(basically, ensure you only have one JAVA_HOME set and it's correct; be sure to close and reopen the terminal after doing this)
If all else fails, the crappy batch file solution:
@echo off
set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_19
ant %*
save as ant_wrapper.bat
(or whatever) and you should be able to do ant_wrapper debug
.
(Both of these solutions are untested)