How to set the JDK for Android Studio?

I'm using OpenJDK 7 with Android Studio and it works just fine. (I don't even have Oracle JDK installed at the moment.)

On that screen that you are showing (Project Structure-->SKD Location) I have the following path for the JDK location: /usr/lib/jvm/java-1.7.0-openjdk-amd64.


By inspecting studio.sh, you can also set one of STUDIO_JDK, JDK_HOME or JAVA_HOME environment variables to point to the JDK location.


studio.sh checks the STUDIO_JDK, JDK_HOME, and JAVA_HOME environment variables in order:

if [ -n "$STUDIO_JDK" -a -x "$STUDIO_JDK/bin/java" ]; then
  JDK="$STUDIO_JDK"
elif [ -n "$JDK_HOME" -a -x "$JDK_HOME/bin/java" ]; then
  JDK="$JDK_HOME"
elif [ -n "$JAVA_HOME" -a -x "$JAVA_HOME/bin/java" ]; then
  JDK="$JAVA_HOME"

So you can just set them as appropriate and then Studio will pick it up.