Alex Cohn Alex Cohn - 4 months ago 28
Java Question

Android Studio and JRE on OS X

Installing AndroidStudio 2.0 on OS X El Capitan: if I install JRE 7 from http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html, I will not receive Public Updates; if I install JRE 8, Android Studio complains that it cannot use secure connection to receive upgrades:

Android Studio and Java screenshot

Is there a way to convince AS that JRE 8 is not JRE 6? If impossible, which compromise is preferable: downgrade to JRE 7 and establish secure connection for Android Studio upgrades, or keep the latest JRE and wait for Android Studio fix?

Answer

From the documentation, by default Android Studio is launched from java 6: http://tools.android.com/tech-docs/configuration/osx-jdk

As it is mentioned you can export an env variable to indicate Android Studio what jdk to use :

export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk<version>.jdk

In order to keep this env variable accessible from the GUI, you can add the following line to your ~/.profile file :

launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk<version>.jdk

Hope it helps.