14

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

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

Vy Do
  • 509
  • 1
  • 3
  • 13

1 Answers1

20

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
Vy Do
  • 509
  • 1
  • 3
  • 13
  • 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 answers that give more complete lists. – mernst Oct 02 '22 at 20:00