@echo off rem Remember to change the name of this file to findjava.bat if not !ready! == yes ( set ready=yes cmd /V:ON /K findjava set ready=no goto :eof ) set ANT_HOME= set JRE= set JDK= rem look for jdk6 and jre6 under Program Files in the C: and D: drives for /D %%l in (C D) do ( set d=%%l:\Program Files\Java\jdk6 if exist "!d!\bin" ( if not defined JDK (set JDK=!d!) if not defined JRE (set JRE=!d!) ) set d=%%l:\Program Files\Java\jre6 if exist "!d!\bin" ( if not defined JRE (set JRE=!d!) ) ) rem look for jdk and jre installations in the C: and D: drives for /D %%j in (1.6.0_21 1.6.0_20 1.6.0_19 1.6.0_18 1.6.0_17 1.6.0_16 1.6.0_15 1.6.0_14 1.6.0_13 1.6.0_12 1.6.0_11 1.6.0_10 1.6.0_09 1.6.0_08 1.6.0_07 1.6.0_06 1.6.0_05 1.6.0_04 1.6.0_03 1.6.0_02 1.6.0_01) do ( for /D %%l in (C D) do ( set d=%%l:\Program Files\Java\jdk%%j if exist "!d!" ( if not defined JDK (set JDK=!d!) ) set r=!d!\jre if exist "!r!" ( if not defined JRE (set JRE=!r!) ) set d=%%l:\j2sdk%%j if exist "!d!" ( if not defined JDK (set JDK=!d!) ) set r=!d!\jre if exist "!r!" ( if not defined JRE (set JRE=!r!) ) set r=%%l:\Program Files\Java\jre%%j if exist "!r!" ( if not defined JRE (set JRE=!r!) ) ) ) if defined JDK ( echo JDK=%JDK% set JAVA_HOME=%JDK% ) else ( echo cannot find a JDK ) if defined JRE ( echo JRE=%JRE% set path=%JRE%\bin;%path% ) else ( if defined JDK ( set path=%JDK%\bin;%path% echo could not find a separate JRE, adding %JDK%\bin to your PATH ) else ( echo cannot find a JRE ) )