title: What's the difference between openjdk and cask java in brew?
body: <p>I installed <code>brew install gradle</code> and it installed <code>openjdk</code> as a dependency.</p>
  <p>But it won't changed the default <code>java</code> as it still points to <code>HotSpot</code>.</p>
  <p>I tried to make <code>openjdk</code> as default java, and Google told me that there's yet some another java package <code>brew install cask java</code>.</p>
  <p>What's the difference between those, which version should I use with gradle and how to install it as a default java system-wide, with proper JAVA_HOME variables?</p>
  <pre><code>Mac OS 10.12.4
  
  Homebrew 2.4.8
  
  Gradle 6.5.1
  
  (default java that was before installation)
  java version &quot;11.0.1&quot; 2018-10-16 LTS
  Java(TM) SE Runtime Environment 18.9
  Java HotSpot(TM) 64-Bit Server VM 18.9
  
  (default java that was before installation)
  javac 11.0.1
  
  (installed by brew as a dependency of gradle)
  openjdk: stable 14.0.1
  </code></pre>
  <p>P.S.</p>
  <p>And why <code>brew install gradle</code> decided to install additional <code>openjdk</code> when I already have HotSpot JDK (and javac) on my machine?</p>