Now it is possible to install openjdk-11 this way:
sudo apt-get install openjdk-11-jdk
(Previously it installed openjdk-10, but not anymore)
Answer from user5479362 on Stack Overflowjava - How to install JDK 11 under Ubuntu? - Stack Overflow
how to change the version of java from 8 to 11 on ubuntu without sudo - Stack Overflow
How to update java in Ubuntu - Stack Overflow
What is the point of all these new Java versions when Java 8 is all that seems to be supported by most apps?
Videos
Now it is possible to install openjdk-11 this way:
sudo apt-get install openjdk-11-jdk
(Previously it installed openjdk-10, but not anymore)
To install Openjdk 11 in Ubuntu, the following commands worked well.
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt install openjdk-11-jdk
Note: WebUpd8 team's PPA has been discontinued with effective from April 16, 2019. Thus this PPA doesn't have any Java files. More information can be found on PPA's page on Launchpad. Hence this method no longer works and exists because of historical reasons.
Use ppa :
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
if you want java8 :
sudo apt-get install oracle-java8-installer
If you ABSOLUTELY need to have the latest update of java you must manualy install from official source, follow this tuto : http://www.cyberciti.biz/faq/howto-installing-oracle-java7-on-ubuntu-linux/
But I advise you to wait as ppa update
Today (2022/Nov), I just reach it with one command line:
apt install openjdk-17-jdk openjdk-17-jre