title: How to install Java 9 and 10 on Mac with Homebrew?
body: <p>I tried to install Java 9 and 10 on macOS with Homebrew:</p>
  
  <pre><code>brew cask install java9
  </code></pre>
  
  <p>I got the following error:</p>
  
  <blockquote>
    <p>Error: Cask 'java9' is unavailable: No Cask with this name exists.</p>
  </blockquote>
  
  <p>and:</p>
  
  <pre><code>brew cask install caskroom/versions/java9
  </code></pre>
  
  <p>gave me:</p>
  
  <blockquote>
    <p>Error: Cask 'java9' is unavailable:</p>
    
    <p>'/usr/local/Homebrew/Library/Taps/caskroom/homebrew-versions/Casks/java9.rb'
    does not exist.</p>
  </blockquote>
  
  <p>Why doesn't this work and how can I install Java on macOS?</p>