title: OS X Yosemite not finding Java 8 runtime
body: <p>I installed Java 8 SDK (with update 25 for JRE) from the Oracle Java site using the instructions on this page</p>
  <pre><code>http://docs.oracle.com/javase/8/docs/technotes/guides/install/mac_jdk.html
  </code></pre>
  <p>and put the following line in my <code>~/.bash_profile</code></p>
  <pre><code>export JAVA_HOME=&quot;/usr/libexec/java_home -v 1.8&quot;
  </code></pre>
  <p>but when I try to compile or run a Java program in Bash I get the following message</p>
  <pre><code>No Java runtime present, requesting install.
  </code></pre>
  <p>and this window</p>
  <p><img src="https://i.stack.imgur.com/iFTfR.jpg" alt="" /></p>
  <p>I ran <code>/usr/libexec/java_home</code> to check:</p>
  <pre><code>$ /usr/libexec/java_home
  Unable to find any JVMs matching version &quot;(null)&quot;.
  No Java runtime present, try --request to install.
  </code></pre>
  <p>But the JRE is in</p>
  <pre><code>/System/Library/Frameworks/JavaVM.framework/Versions/Current
  </code></pre>
  <p>and the JRE location in System Preferences is pointing to</p>
  <pre><code>/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin
  </code></pre>
  <p>I don't know what the problem is here, but <code>usr/bin/javac</code> and <code>/usr/bin/java</code> are not able to find the correct JVM location in <code>/System/Library/Frameworks/JavaVM.framework/Versions/Current</code>.</p>