-3

What is the usual way of installing a different version of a program on Ubuntu?

1 Answers1

2

Some programs allow more than one version to be installed at the same time. Some examples includes php, python, java, etc.

From the Software Center or the commandline, specify the version you want to install.

To install the default version of the program (openjdk) in this case run:

$ sudo apt install openjdk

You can use apt search option to check the available version from your installed repository with this command (among other variations). I'm including the command and the output in this example:

$ apt search openjdk | egrep ^open.*jdk/

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

openjdk-6-jdk/lucid 6b18-1.8-0ubuntu1 amd64
openjdk-8-jdk/xenial-updates,xenial-security,now 8u162-b12-0ubuntu0.16.04.2 amd64 [installed]
openjdk-9-jdk/xenial,now 9~b114-0ubuntu1 amd64 [installed]
ljames@ubunzeus:~$

To install openjdk version 8, I would run this command (as an example):

$ sudo apt install openjdk-8-jdk

In short, run the install as normal and include the version of the application as part of the install command.

L. D. James
  • 25,444