3

I initially had default-jdk and default-jre installed on Ubuntu 18.04.

Attempted to host a Minecraft Server for a friend, but was given the error found here

I followed the commentor's advice to reinstall java version 8 rather than version 11 installed above, by following this advice here that being

sudo rm -r /usr/lib/jvm/java-11-oracle

but as a mistake I had removed all files in that folder, leaving just the two directories

  1. java-11-openjdk-amd64
  2. java-8-openjdk-amd64

since then I have attempted to reinstall java using sudo apt-get install default-jdk ; sudo apt-get install default-jre and they install just fine, but running java -version, either as root or as user, returns:

Command 'java' not found, but can be installed with:

  1. sudo apt install default-jre
  2. sudo apt install openjdk-11-jre-headless
  3. sudo apt install openjdk-8-jre-headless

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?

I appreciate any and all responses

tjsucksatcoding
  • 151
  • 1
  • 1
  • 6

2 Answers2

10

Solution has been found. Running:

sudo apt purge -y openjdk-11-jre-headless
sudo apt purge -y openjdk-8-jre-headless
sudo apt purge -y default-jdk

and reinstalling has resolved the issue

Pedro Rodrigues
  • 2,520
  • 2
  • 27
  • 26
tjsucksatcoding
  • 151
  • 1
  • 1
  • 6
0

Check your path. You should have remove the old jdk using apt-get. I think your system still assumes the old jdk-11 is still present. You could try to re-install it or use update-alternatives to switch to the other version.

Axel
  • 13,939
  • 5
  • 50
  • 79
  • I've attempted that a few times in a couple variations, 'sudo update-alternatives --config java' returns 'update-alternatives: error: no alternatives for java' while 'sudo update-alternatives --config javac' works just fine, whereby I select '/usr/lib/jvm/java-8-openjdk-amd64/bin/javac 1081 manual mode' as I am attempting to run java8 – tjsucksatcoding Feb 24 '20 at 23:18