Alex Cohn Alex Cohn - 1 year ago 79
Java Question

Android Studio and JRE on OS X

Installing AndroidStudio 2.0 on OS X El Capitan: if I install JRE 7 from, 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 Source

From the documentation, by default Android Studio is launched from java 6:

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.