OSDN Git Service

Don't regenerate R.java if a non xml resource is modified.
[android-x86/sdk.git] / files / find_java.bat
1 @echo off\r
2 rem Copyright (C) 2007 The Android Open Source Project\r
3 rem\r
4 rem Licensed under the Apache License, Version 2.0 (the "License");\r
5 rem you may not use this file except in compliance with the License.\r
6 rem You may obtain a copy of the License at\r
7 rem\r
8 rem      http://www.apache.org/licenses/LICENSE-2.0\r
9 rem\r
10 rem Unless required by applicable law or agreed to in writing, software\r
11 rem distributed under the License is distributed on an "AS IS" BASIS,\r
12 rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13 rem See the License for the specific language governing permissions and\r
14 rem limitations under the License.\r
15 \r
16 rem This script is called by the other batch files to find a suitable Java.exe\r
17 rem to use. The script changes the "java_exe" env variable. The variable\r
18 rem is left unset if Java.exe was not found.\r
19 \r
20 rem Useful links:\r
21 rem Command-line reference:\r
22 rem   http://technet.microsoft.com/en-us/library/bb490890.aspx\r
23 \r
24 rem Check we have a valid Java.exe in the path. The return code will\r
25 rem be 0 if the command worked or 9009 if the exec failed (program not found).\r
26 rem Java itself will return 1 if the argument is not understood.\r
27 set java_exe=java\r
28 %java_exe% -version 2>nul\r
29 if ERRORLEVEL 1 goto SearchForJava\r
30 goto :EOF\r
31 \r
32 \r
33 rem ---------------\r
34 :SearchForJava\r
35 rem We get here if the default %java_exe% was not found in the path.\r
36 rem Search for an alternative in %ProgramFiles%\Java\*\bin\java.exe\r
37 \r
38 echo.\r
39 echo WARNING: Java not found in your path.\r
40 \r
41 rem Check if there's a 64-bit version of Java in %ProgramW6432%\r
42 if not defined ProgramW6432 goto :Check32\r
43 echo Checking if it's installed in %ProgramW6432%\Java instead (64-bit).\r
44 \r
45 set java_exe=\r
46 for /D %%a in ( "%ProgramW6432%\Java\*" ) do call :TestJavaDir "%%a"\r
47 if defined java_exe goto :EOF\r
48 \r
49 rem Check for the "default" 32-bit version\r
50 :Check32\r
51 echo Checking if it's installed in %ProgramFiles%\Java instead.\r
52 \r
53 set java_exe=\r
54 for /D %%a in ( "%ProgramFiles%\Java\*" ) do call :TestJavaDir "%%a"\r
55 if defined java_exe goto :EOF\r
56 \r
57 echo.\r
58 echo ERROR: No suitable Java found. In order to properly use the Android Developer\r
59 echo Tools, you need a suitable version of Java JDK installed on your system.\r
60 echo We recommend that you install the JDK version of JavaSE, available here:\r
61 echo   http://www.oracle.com/technetwork/java/javase/downloads\r
62 echo.\r
63 echo You can find the complete Android SDK requirements here:\r
64 echo   http://developer.android.com/sdk/requirements.html\r
65 echo.\r
66 goto :EOF\r
67 \r
68 rem ---------------\r
69 :TestJavaDir\r
70 rem This is a "subrountine" for the for /D above. It tests the short version\r
71 rem of the %1 path (i.e. the path with only short names and no spaces).\r
72 rem However we use the full version without quotes (e.g. %~1) for pretty print.\r
73 if defined java_exe goto :EOF\r
74 set full_path=%~1\bin\java.exe\r
75 set short_path=%~s1\bin\java.exe\r
76 \r
77 %short_path% -version 2>nul\r
78 if ERRORLEVEL 1 goto :EOF\r
79 set java_exe=%short_path%\r
80 \r
81 echo.\r
82 echo Java was found at %full_path%.\r
83 echo Please consider adding it to your path:\r
84 echo - Under Windows XP, open Control Panel / System / Advanced / Environment Variables\r
85 echo - Under Windows Vista or Windows 7, open Control Panel / System / Advanced System Settings / Environment Variables\r
86 echo At the end of the "Path" entry in "User variables", add the following:\r
87 echo   ;%full_path%\r
88 echo.\r