title: java command not running from JAVA_HOME on Mac Caralina
body: <p>I installed java 8 and openjdk 11 on my Mac. JAVA_HOME is set to java 8, but when running java --version, it points to openjdk 11. Why is it happens and how can I make java command point to java 8?</p>
  <p>running the command</p>
  <pre><code>echo $JAVA_HOME
  java --version
  </code></pre>
  <p>output is</p>
  <pre><code>/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home
  openjdk 11.0.8 2020-07-14
  OpenJDK Runtime Environment (build 11.0.8+11)
  OpenJDK 64-Bit Server VM (build 11.0.8+11, mixed mode)
  
  </code></pre>
  <p>It is so wired.</p>