title: Execution failed for task ':CordovaLib:compileDebugJava'
body: <p>I want to run my <strong>ionic app</strong> in <strong>android emulator</strong>. When I try to build ionic app using the following command in terminal:</p>
  
  <pre><code>ionic build android
  </code></pre>
  
  <p>It shows the following error ::</p>
  
  <pre><code>  FAILURE: Build failed with an exception.
  
    * What went wrong:
      Execution failed for task ':CordovaLib:compileDebugJava'.
        &gt; 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.
  
    * Try:
      Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  
    BUILD FAILED
  
    Total time: 20.383 secs
  
   /home/meutics/ionicapp/ebook-   app/platforms/android/cordova/node_modules/q/q.js:126
  
      throw e;
            ^
       Error code 1 for command: /home/meutics/ionicapp/ebook-app/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/meutics/ionicapp/ebook-app/platforms/android/build.gradle,-Dorg.gradle.daemon=true
  </code></pre>
  
  <p>Seems <strong>JAVA_HOME</strong> is not correctly configured, but I think I configure  <strong>JAVA_HOME</strong> correctly. </p>
  
  <p>In <strong>terminal</strong> window, I run the following command ::</p>
  
  <pre><code> meutics@meutics-pc:~$ echo $JAVA_HOME
   /usr/lib/jvm/java-7-openjdk-amd64
  </code></pre>
  
  <p>In <strong>.bashrc</strong> window,<code>vi ~/.bashrc</code></p>
  
  <pre><code>  export PATH=$PATH:/home/meutics/Downloads/android-studio/bin
    export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
    export PATH=$PATH:$JAVA_HOME/bin
    export ANDROID_HOME=/home/meutics/Android/Sdk
    export PATH=$PATH:$ANDROID_HOME:$ANDROID_HOME/tools:$ANDROID_HOME/build-tools
  </code></pre>
  
  <p>How can I solve this problem?</p>
  
  <p>NB: In <code>/usr/lib/jvm/</code> directory, </p>
  
  <pre><code>root@meutics-pc:/usr/lib/jvm# ls 
  java-1.7.0-openjdk-amd64  java-7-openjdk-amd64  java-8-oracle
  </code></pre>
  
  <p>And <strong>java version</strong> ::</p>
  
  <pre><code>   meutics@meutics-pc:$ java -version
     java version "1.8.0_60"
     Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
     Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
  </code></pre>