aboutsummaryrefslogtreecommitdiffstats
path: root/files
diff options
context:
space:
mode:
authorRaphael Moll <ralf@android.com>2011-08-26 14:13:16 -0700
committerRaphael <raphael@google.com>2011-09-01 00:39:49 -0700
commit11583ccac791c5bb13a3c7bf98e5031d8e7eee9f (patch)
treedc0da451645ddcc1054846c02a982875ffa81317 /files
parent13c683ff67c8bd519f79a462874b2de260715315 (diff)
downloadsdk-11583ccac791c5bb13a3c7bf98e5031d8e7eee9f.zip
sdk-11583ccac791c5bb13a3c7bf98e5031d8e7eee9f.tar.gz
sdk-11583ccac791c5bb13a3c7bf98e5031d8e7eee9f.tar.bz2
Windows: look for Java in %ProgramFiles(x86)%.
Cf bug 19551. Change-Id: Id5ce9b0e792e7e189f9fc12e0dcfc6a63e0e2704
Diffstat (limited to 'files')
-rwxr-xr-xfiles/find_java.bat28
1 files changed, 23 insertions, 5 deletions
diff --git a/files/find_java.bat b/files/find_java.bat
index b8f557b..13cb74c 100755
--- a/files/find_java.bat
+++ b/files/find_java.bat
@@ -38,22 +38,40 @@ rem Search for an alternative in %ProgramFiles%\Java\*\bin\java.exe
echo.
echo WARNING: Java not found in your path.
-rem Check if there's a 64-bit version of Java in %ProgramW6432%
+rem The strategy is to look for Java under these 3 locations:
+rem - %ProgramFiles%, which may point to either a 32-bit or 64-bit install
+rem depending on the current invocation context
+rem - %ProgramW6432%, which points to a 32-bit install. This may not be defined.
+rem - %ProgramFiles(x86)%, which points to a 64-bit install. This may not be defined.
+
+if not defined ProgramFiles goto :Check64
+echo Checking if Java is installed in %ProgramFiles%\Java.
+
+set java_exe=
+for /D %%a in ( "%ProgramW6432%\Java\*" ) do call :TestJavaDir "%%a"
+if defined java_exe goto :EOF
+
+rem Check for the "default" 64-bit version if it's not the same path
+:Check64
if not defined ProgramW6432 goto :Check32
-echo Checking if it's installed in %ProgramW6432%\Java instead (64-bit).
+if "%ProgramW6432%"=="%ProgramFiles%" goto :Check32
+echo Checking if Java is installed in %ProgramW6432%\Java instead (64-bit).
set java_exe=
for /D %%a in ( "%ProgramW6432%\Java\*" ) do call :TestJavaDir "%%a"
if defined java_exe goto :EOF
-rem Check for the "default" 32-bit version
+rem Check for the "default" 32-bit version if it's not the same path
:Check32
-echo Checking if it's installed in %ProgramFiles%\Java instead.
+if not defined ProgramFiles(x86) goto :CheckFailed
+if "%ProgramFiles(x86)%"=="%ProgramFiles%" goto :CheckFailed
+echo Checking if Java is installed in %ProgramFiles(x86)%\Java instead (32-bit).
set java_exe=
-for /D %%a in ( "%ProgramFiles%\Java\*" ) do call :TestJavaDir "%%a"
+for /D %%a in ( "%ProgramFiles(x86)%\Java\*" ) do call :TestJavaDir "%%a"
if defined java_exe goto :EOF
+:CheckFailed
echo.
echo ERROR: No suitable Java found. In order to properly use the Android Developer
echo Tools, you need a suitable version of Java JDK installed on your system.