title: gradlew uses wrong Java version
body: <p>I am working on an android application using Kotlin. I am running a kotlin linter through command line ./gradlew klint.<br>
  But it gives me an error:</p>
  
  <blockquote>
    <p>Gradle 4.4 requires Java 7 or later to run. You are currently using Java 6.</p>
  </blockquote>
  
  <p>When I check the project structure, I am using the embedded JDK.<br>
  I also updated android studio to latest version. I do not know how to update the embedded JDK to latest version.</p>
  
  <p><code>java version</code></p>
  
  <blockquote>
    <p>"1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)</p>
  </blockquote>
  
  <p><code>which java</code> - /usr/bin/java  </p>
  
  <p><code>echo $PATH</code> - <code>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/username/Library/Android/sdk/platform-tools</code>    </p>
  
  <p><code>echo $JAVA_HOME</code> - empty</p>