title: Using JDK that is bundled inside Android Studio as JAVA_HOME on Mac
body: <p>I tried to open Android Device Monitor and the Studio showed me this message =-O :
  <a href="https://i.stack.imgur.com/SUlHl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SUlHl.png" alt="need to install Java SE 6 runtime error"></a></p>
  
  <p>It surprised me, because how have I been able to develop Android apps if I didn't have any Java installed?! Actually, Android Studio comes with bundled JDK/JRE (located in <code>/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home</code>), but it is not found by the system: executed <code>usr/libexec/java_home</code> gives</p>
  
  <pre><code>Unable to find any JVMs matching version "(null)".
  No Java runtime present, try --request to install.
  </code></pre>
  
  <p>Setting <code>$JAVA_HOME</code> to <code>/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home</code> did not help — <code>source .bash_profile</code> doesn't like that it's a directory.</p>
  
  <p>QUESTION: I don't want to install new JDK if I already have one inside Android Studio. How do I set it as system default?</p>