Wednesday, August 4, 2010

Installing the Android SDK with a non-standard JDK location

I recently had cause to download and install the Android SDK in Windows that was precipitated by a series of you-need-this-to-install-that events. When I launched the "SDK Setup.exe" to install, it popped up with a request to install yet another piece of software, the Java Development Kit.


I have an Solid State Drive in my desktop and to avoid burning it, I install anything I don't expect to use much on an old 120GB disk which is set as my B:\ drive (1.22MB ... 120GB ... close enough). Once I'm done with the JDK I planed on uninstalling it so, naturally, I stuck it in "B:\Program Files", relaunched the Android SDK installer and was again told that I need to install Java's Oracle's JDK.


I'll spare everyone the boring details of how I figured out what needed to be changed to fix it and jump right to the fix:
  1. Go to where you extracted the Android SDK zip archive.
  2. Once there, navigate to "android-sdk-windows\tools\lib"
  3. In that folder right click "find_java.bat" and hit edit (or open it with your preferred text editor).
  4. Shortly after several comment lines starting 'rem' you'll see a line that looks like the following: 'for /D %%a in ( "%ProgramFiles%\Java\*" ) do call :TestJavaDir "%%a"'.
  5. Change '%ProgramFiles%\Java' to your JDK installation path. In my case on a 64bit Windows 7 machine, it was "B:\Program Files\Java"
  6. The full line now looks like the following 'for /D %%a in ( "B:\Program Files\Java\*" ) do call :TestJavaDir "%%a"' (note that I left the '\*' after "Java" untouched).

No comments:

Post a Comment