Two questions.

Can I safely simply remove a tar.gz file for java that I found?

What are the steps to remove java 12 and install java 8 on ubuntu 16.04?

If this has been asked and answered before, I apologize. Please provide instructions or a link at least for removing 12. Sources that have copy/paste commands are best, since I don't have background knowledge that programmers have to fill in blanks. I'm just retail.

I forget exactly what I've tried. Normally things work eventually, but I've been at this for days. I've been to so many web pages I can't remember where I've found information. Some pages are as old as 10 years. Many are for earlier versions of ubuntu. Some provide commands to install/remove openjdk and others are just jdk.

1) 16.04 has been working for me for a couple years, apparently with java 8. Recently it suggested that 18.04 was available, and I finally got that installed. But too many things didn't work the same, and I reinstalled 16.04 from scratch from a USB stick.

2) After that, one app that I use every day was giving me an error message Every Time I brought it up. Never happened before. I thought that upgrading java to version 12 might help/couldn't hurt.

I forget the exact steps used to remove java 8 and don't want to hunt for it again. I remember the command included something like "8.0_222". Somehow I found that there are still a lot of files that reference "8.0_221" as below.


Can I just delete the *tar.gz file at the bottom?

At any rate, I finally got no output for 'java -version'.

3) When I went to install java 12, one of the procedures resulted in a DOS-type box that wanted me to accept oracle's license. But it didn't respond -- at all -- to the keyboard or mouse. I had to close other apps and shut the machine down. That happened a couple times, including the box. One of those times I saw the box change from OK to yes/no -- just as it disappeared and I don't know what input it got. I suppose I said Yes and it ran in the background (no output in the terminal window), because later I was trying other commands and all of a sudden it said that version 12 was installed! No idea how that happened, but my current tests (from various sources) have the following output. So I think now I only have 12 on the system.


4) Now my app says that it needs java 8 or later just to install. So I need to go back to version 8. Some pages indicate that you can have multiple versions on the machine, you set a default version and you can switch. I don't know how that works. Life with 16.04 was fine before all this, so I think to remove 12 and reinstall 8. But I can't find instructions that I'm comfortable with to remove 12.

There are so many sources. The last bullet point on this one from Oracle (I've never used rpm to install anything) says to just remove a directory. That's it? It refers to version 1.7 and the current version is 12? Here is a directory I found. The name format is different from any other examples I've seen.

enter image description here

I think I saw a reference to an openjdk for version 12, which I think is all I need. But what I see on my system doesn't start with "open", as numerous pages specify.

What do I do, please?


Per the comments (THANK YOU), I used the commands below, in this order. I didn't do any of the other steps specified in the links.

I don't know what leaving version 12 in place does, and I didn't set default for javac. (Replace 2 highlighted instances of "java" below with "javac", according to this.) But I was able to install my problem app -- Thank You again. It still gives me an error when I load it, but I'll see if the creators will help with that.

sudo apt-get install openjdk-8-jdk [installs version 8]

update-java-alternatives --list [shows what versions are installed]

sudo update-alternatives --config java [allows to choose default]

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.