13

Today, oracle release JDK 19. How to install JDK 19 on Ubuntu 22.04 LTS?

https://www.oracle.com/java/technologies/downloads/

Vy Do
  • 489
  • 1
  • 3
  • 12

1 Answers1

19

commands

wget https://download.oracle.com/java/19/latest/jdk-19_linux-x64_bin.deb

sudo apt-get -qqy install ./jdk-19_linux-x64_bin.deb

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-19/bin/java 1919

check result

root@vypc:~# java -version
java version "19" 2022-09-20
Java(TM) SE Runtime Environment (build 19+36-2238)
Java HotSpot(TM) 64-Bit Server VM (build 19+36-2238, mixed mode, sharing)

See https://ubuntuhandbook.org/index.php/2022/03/install-jdk-18-ubuntu/

mernst
  • 103
  • 4
Vy Do
  • 489
  • 1
  • 3
  • 12
  • 1
    You also need to run `update-alternatives` for every other program you want to run, such as `javac`, `javadoc`, and more. Here are [two](https://stackoverflow.com/a/53902806/173852) [answers](https://askubuntu.com/a/159585/35128) that give more complete lists. – mernst Oct 02 '22 at 20:00