Command Line

Android Studio Was Unable to Find JVM

I have finally upgraded my Android Studio to its official version 1.0+ on my Macbook (I am using the Mavericks OS)! But there came a huuuge problem when I tried to open it from my Applications folder; Android Studio was unable to find my JVM.

Under this reference from Android Tools Project Site, the recommended steps were to do these in your (assuming your JDK version is 1.7.0v67):

export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk
open /Applications/Android

But that’ll mean that you need to always use your terminal to open Android Studio. Not good. 🙁

The same reference also mentioned though:

You can also place use environment variables to point to specific override files elsewhere:

  • STUDIO_VM_OPTIONS, which vmoptions file to use
  • STUDIO_PROPERTIES, which property file to use
  • STUDIO_JDK, which JDK to run studio with

So do this instead:

First, find out which version of JDK you’re using.
ls /Library/Java/JavaVirtualMachines/

Next, set the environment for STUDIO_JDK in launchd.conf.
sudo vi /etc/launchd.conf
Add into launchd.conf and save the file:
setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk

Finally, reboot your computer.

Type in export into your terminal, and you should see STUDIO_JDK set with the JDK you had specified with. You will now be able to open Android Studio from your Applications folder.

Note: /etc/launchd.conf is not supported from Mac OS X 10.10 onwards. Use launchctl instead if you have upgraded to the Yosemite OS.

Leave a Reply

Your email address will not be published. Required fields are marked *