title: How to instruct Gradle to use Java from different location?
body: <p>I was building my test app in Android Studio, then in the Event Log it said: </p>
  
  <blockquote>
    <p>Android Studio is using this JDK location:            C:\Program
    Files\Android\Android Studio\jre          which is different to what Gradle
    uses by default:          C:\Program Files (x86)\Java\jdk1.8.0_181            Using
    different locations may spawn multiple Gradle daemons if          Gradle
    tasks are run from command line while using Android Studio.           </p>
  </blockquote>
  
  <p>Then gave these options: </p>
  
  <blockquote>
    <ol>
    <li>More info...</li>
    <li>Set Android Studio to use the same JDK as Gradle and sync</li>
    <li>Do not show this warning again</li>
    </ol>
  </blockquote>
  
  <p>I clicked on: </p>
  
  <blockquote>
    <p>Set Android Studio to use the same JDK as Gradle and sync</p>
  </blockquote>
  
  <p>then my app didn't want to build any more.</p>
  
  <p>This is the error:</p>
  
  <blockquote>
    <p>Gradle sync failed: Unable to start the daemon process.<br>
    This
    problem might be caused by incorrect configuration of the daemon.</p>
    
    <p>For example, an unrecognized jvm option is used.<br>
    Please refer to
    the User Manual chapter on the daemon at
    <a href="https://docs.gradle.org/5.4.1/userguide/gradle_daemon.html" rel="noreferrer">https://docs.gradle.org/5.4.1/userguide/gradle_daemon.html</a>            </p>
    
    <p>Process command line: C:\Program Files (x86)\Java\jdk1.8.0_181\bin\java.exe
    -Xmx1536m -Dfile.encoding=windows-1252 -Duser.country=ZA -Duser.language=en -Duser.variant -cp C:\Users\{MyUserName}\.gradle\wrapper\dists\gradle-5.4.1-all\3221gyojl5jsh0helicew7rwx\gradle-5.4.1\lib\gradle-launcher-5.4.1.jar
    org.gradle.launcher.daemon.bootstrap.GradleDaemon 5.4.1           </p>
    
    <p>Please read
    the following process output to find out more:</p>
    
    <p>Error occurred during initialization of
    VM            Could not reserve enough space for 1572864KB object heap
              Consult IDE log for more details (Help | Show Log) (16 s 166 ms)</p>
  </blockquote>
  
  <p>I checked the event logs:</p>
  
  <p>I think previously it did this:</p>
  
  <blockquote>
    <p>Instructing gradle to use java from C:/Program Files/Android/Android
    Studio/jre</p>
  </blockquote>
  
  <p>Now it says this:</p>
  
  <blockquote>
    <p>Instructing gradle to use java from C:/Program Files
    (x86)/Java/jdk1.8.0_181</p>
  </blockquote>
  
  <p>How do I set it back to the way it was so my app can build again?</p>
  
  <p>Any help / advice will be appreciated</p>