title: Ubuntu 18.04 Java Command Not Found Despite Being Installed
body: <p>I initially had default-jdk and default-jre installed on Ubuntu 18.04. </p>
  
  <p>Attempted to host a Minecraft Server for a friend, but was given the error found <a href="https://www.minecraftforge.net/forum/topic/65727-server-boot-problem/" rel="nofollow noreferrer">here</a></p>
  
  <p>I followed the commentor's advice to reinstall java version 8 rather than version 11 installed above, by following this advice <a href="https://askubuntu.com/a/1120163">here</a> that being</p>
  
  <pre><code>sudo rm -r /usr/lib/jvm/java-11-oracle
  </code></pre>
  
  <p>but as a mistake I had removed all files in that folder, leaving just the two directories</p>
  
  <ol>
  <li>java-11-openjdk-amd64  </li>
  <li>java-8-openjdk-amd64</li>
  </ol>
  
  <p>since then I have attempted to reinstall java using <code>sudo apt-get install default-jdk ; sudo apt-get install default-jre</code> and they install just fine, but running java -version, either as root or as user, returns:</p>
  
  <p>Command 'java' not found, but can be installed with:</p>
  
  <ol>
  <li>sudo apt install default-jre</li>
  <li>sudo apt install openjdk-11-jre-headless</li>
  <li>sudo apt install openjdk-8-jre-headless</li>
  </ol>
  
  <p>I have scoured askubuntu, digitalocean, and stackoverflow for some answers but I can't find anything that fixes this problem. I also asked my roommate, who is an experienced Computer Science major and who has used ubuntu extensively in the past, and he couldn't find a solution. Has anyone encountered this issue before?</p>
  
  <p>I appreciate any and all responses </p>