title: Failed to run "javac -version" make sure that you have a JDK version 8 installed
body: <p>I am new to ionic and I have tried everything available on the internet regarding this issue but i haven`t found any suitable/matching solution.</p>
  <p>Details of my problem :</p>
  <p>I am working with ionic 5 and when I am running <code>ionic cordova run android</code> then after a while I have got the following error :</p>
  <pre><code>Failed to run &quot;javac -version&quot;, make sure that you have a JDK version 8 installed.
  You can get it from the following location:
  https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
  
  Your JAVA_HOME is invalid: /usr/lib/jvm/java-8-openjdk-amd64
  [ERROR] An error occurred while running subprocess cordova.
      
      cordova build android --device exited with exit code 1.
      
      Re-running this command with the --verbose flag may provide more information.
  </code></pre>
  <p>I have already installed java, cordova and android studio on my PC(ubuntu 16.04) following are some details :</p>
  <p>command : <code>java -version</code></p>
  <p>result  :</p>
  <pre><code>openjdk version &quot;1.8.0_252&quot;
  OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~16.04-b09)
  OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
  </code></pre>
  <p>command : <code>javac -version</code>
  result  :</p>
  <pre><code>The program 'javac' can be found in the following packages:
   * default-jdk
   * ecj
   * gcj-5-jdk
   * openjdk-8-jdk-headless
   * gcj-4.8-jdk
   * gcj-4.9-jdk
   * openjdk-9-jdk-headless
  Try: sudo apt install &lt;selected package&gt;
  </code></pre>