Want to install JDK 19 on your Debian or Ubuntu server? No problem!
In this blog post we'll show you step by step how to install the Java Development Kit (JDK) 19 on your Debian or Ubuntu system.
First you need to update your package lists. You can do that with the following command:
sudo apt update Next, install the packages needed for the JDK 19 installation:
sudo apt install curl ca-certificates apt-transport-https gnupg -y To install Oracle JDK 19, you first need to add the Oracle repository to your APT sources. Use the following command to add the Oracle public key:
curl -sL https://download.oracle.com/java/GA/jdk19/2/GPL/keytoolkit.asc | sudo apt-key add - Now add the repository to your APT sources:
echo "deb http://download.oracle.com/java/GA/jdk19/2/GPL/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/jdk19.list Update your package lists again:
sudo apt update Now you can install JDK 19 with the following command:
sudo apt install oracle-java19-installer -y You can check whether the installation was successful and which Java version is installed on your system with the following command:
java -version Now it's time to set the environment variables. You can set the Java environment variables by running the following command:
sudo apt install oracle-java19-set-default Congratulations! You've successfully installed JDK 19 on your Debian or Ubuntu server. Now you can start developing and running your Java applications.
Don't forget to check for updates regularly and install them, to make sure your system and applications stay current and secure. You can do this by running the following commands:
sudo apt update sudo apt upgrade -y