title: Android - Can't compile on JRE - Make sure Gradle is running on a JDK, not JRE
body: <p>I want to compile my app from command line, and not from Android Studio.
  My app works perfectly when I launch it from Android Studio to my device / emulator, however when I try to do :</p>
  
  <pre><code>gradlew build
  </code></pre>
  
  <p>I get :</p>
  
  <pre><code>&gt; Task :app:kaptGenerateStubsReleaseKotlin FAILED
  Caught an exception trying to connect to Kotlin Daemon
  org.gradle.api.GradleException: Kotlin could not find the required JDK tools in the Java installation 'C:\Program Files (x86)\Java\jre1.8.0_191' used by Gradle. Make sure Gradle is running on a JDK, not JRE.
          at org.jetbrains.kotlin.gradle.tasks.JarSearchingUtilKt.findToolsJar(jarSearchingUtil.kt:95)
          at org.jetbrains.kotlin.compilerRunner.GradleCompilerEnvironment$toolsJar$2.invoke(GradleCompilerEnvironment.kt:23)
          at org.jetbrains.kotlin.compilerRunner.GradleCompilerEnvironment$toolsJar$2.invoke(GradleCompilerEnvironment.kt:17)
          at kotlin.SynchronizedLazyImpl.getValue(Lazy.kt:131)
          ...
  </code></pre>
  
  <p>Here is my JAVA_HOME env var :</p>
  
  <pre><code>JAVA_HOME=C:\Program Files (x86)\Java\jre1.8.0_191
  </code></pre>
  
  <p>It IS actually a JRE (and not a JDK), but, when I change my env var by my JDK as following :</p>
  
  <pre><code>JAVA_HOME=C:\Program Files\Java\jdk-11.0.1    
  </code></pre>
  
  <p>And I launch :</p>
  
  <pre><code>gradlew build
  </code></pre>
  
  <p>Then I get :</p>
  
  <pre><code>FAILURE: Build failed with an exception.
  
  * What went wrong:
  Could not determine java version from '11.0.1'.
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  </code></pre>