title: Android Studio can't find JAVA_HOME
body: <p>I can't seem to get my Android applications to compile due to a really annoying exception from Android Studio:</p>
  
  <p><img src="https://i.stack.imgur.com/ufALd.png" alt="]()![enter image description here"></p>
  
  <pre><code>Execution failed for task ':myapp-services:compileDebugJava'.
      Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.
  </code></pre>
  
  <p>I'm on Ubuntu 12.04, and I'm running Oracle's Java 7 JRE/JDK.</p>
  
  <p>In <code>~/.bashrc</code>:</p>
  
  <pre><code>export JAVA_HOME="/usr/lib/jvm/java-7-oracle/"
  </code></pre>
  
  <p>In <code>android-studio/bin/studio.sh</code>:</p>
  
  <pre><code>export JAVA_HOME="/usr/lib/jvm/java-7-oracle/"
  </code></pre>
  
  <p>Output of <code>javac -version</code>:</p>
  
  <pre><code>javac 1.7.0_51
  </code></pre>
  
  <p>Output of <code>java -version</code>:</p>
  
  <pre><code>java version "1.7.0_51"
  Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
  Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
  </code></pre>
  
  <p>Output of <code>printenv JAVA_HOME</code>:</p>
  
  <pre><code>/usr/lib/jvm/java-7-oracle
  </code></pre>
  
  <p>Output of <code>which javac</code>:</p>
  
  <pre><code>/usr/bin/javac
  </code></pre>
  
  <p>I have also logged out and logged back in again to my session.</p>
  
  <p>I'm really not sure what I'm missing here. Why can't Android Studio compile my application?</p>