I am aware of how to install Java 8 in Ubuntu 18.04. The issue is that, now I want to upgrade to say Ubuntu 19.04, but Ubuntu is not letting me do it unless I update openjdk as well.

$ sudo apt list --upgradable 
Listing... Done
code/stable 1.36.1-1562627527 amd64 [upgradable from: 1.36.0-1562161087]
libopenjfx-java/bionic-updates,bionic-updates,bionic-security,bionic-security 11.0.2+1-1~18.04.2 all [upgradable from: 8u161-b12-1ubuntu2]
libopenjfx-jni/bionic-updates,bionic-security 11.0.2+1-1~18.04.2 amd64 [upgradable from: 8u161-b12-1ubuntu2]
openjfx/bionic-updates,bionic-security 11.0.2+1-1~18.04.2 amd64 [upgradable from: 8u161-b12-1ubuntu2]

$ sudo do-release-upgrade
Checking for a new Ubuntu release
Please install all available updates for your release before upgrading.

What is the recommended way to install Java 8 in Ubuntu that doesn't interfere with Ubuntu upgrade. For example I would like to use software development tools in my latest Ubuntu. But could I keep a separate docker or VM that has Java 8. I am hoping to have less performance penalty while having the benefit that I could use all other tools and data (not present in that docker image or VM).

Reference: apt - Upgrade from 18.04 to 19.04 with out updating all softwares - Ask Ubuntu

  • Just to be clear, are you using Oracle's version of Java 8 or the OpenJDK 8? It will be great if you edit your question and indicate how you installed Java 8. Did you use sudo apt install default-jdk or sudo apt install openjdk-8-jdk? With the first, Ubuntu will try to update it to Java 11, as the default changed. With the second, there should not be any update to Java 11. – user68186 Jul 24 at 20:54
  • 2
    I am using OpenJDK – Nikhil Jul 24 at 21:05
  • @user68186 I read your answer, you have described about switching between different versions of Java. At the present I have installed like that. I have both OpenJDK 11 and 8 installed on my Ubuntu 18.04. But, I think Ubuntu is not letting me upgrade because OpenJDK8 is old. – Nikhil Jul 24 at 21:07
  • Both Java 8 and 11 should coexist and one should not be upgraded by the other. My suggestion is to let Ubuntu upgrade Java (security) packages. If that breaks Java 8, then you can remove the Java 8 installation and install it again. It is a risky move. – user68186 Jul 24 at 21:15
  • It looks like the problem is not with Java 8 as a whole, but three OpenJFX files. See how to hold or pin packages you don't want to upgrade. – user68186 Jul 24 at 21:29

Your Answer

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

Browse other questions tagged or ask your own question.