{"id":11658,"date":"2021-10-30T14:40:12","date_gmt":"2021-10-30T14:40:12","guid":{"rendered":"https:\/\/linuxways.net\/?p=11658"},"modified":"2021-10-30T14:40:12","modified_gmt":"2021-10-30T14:40:12","slug":"how-to-install-java-17-lts-jdk-17-on-debian-11","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/debian\/how-to-install-java-17-lts-jdk-17-on-debian-11\/","title":{"rendered":"How to Install Java 17 LTS (JDK 17 ) On Debian 11"},"content":{"rendered":"<p>JDK 17 is finally out and was released on 14, September 2021 with lots of<a href=\"https:\/\/openjdk.java.net\/projects\/jdk\/17\/\"> new features <\/a>on the table. It is the latest LTS version of OpenJDK by the time of publishing this tutorial. So, how do we get OpenJDK 17 on Debian?<\/p>\n<p>Let\u2019s find out.<\/p>\n<h2><strong>Install Java from OpenJDK using the APT package manager<\/strong><\/h2>\n<p>This is the easiest approach to installing Java on your system. OpenJDK ( Open Java Development Kit ) is an opensource and free implementation of Java SE ( Standard Edition ). It provides a number of components including the Java Runtime Environment ( JRE ), Java compiler, Java Class Library, and the Java Virtual Machine.<\/p>\n<p>To install OpenJDK 17, follow the steps outlined below.<\/p>\n<h3><strong>Step 1: Update the package lists on Debian 11<\/strong><\/h3>\n<p>We kick-start the installation of Java 17 by, first, upgrading all the packages as follows.<\/p>\n<pre><strong>$ sudo apt update<\/strong><\/pre>\n<pre><strong>$ sudo apt upgrade<\/strong><\/pre>\n<p>Excellent, the next step is to install OpenJDK 17, so follow the next few steps.<\/p>\n<h3><strong>Step 2: Install OPenJDK 17 on Debian 11<\/strong><\/h3>\n<p>Once all packages are in the latest versions, proceed and install OpenJDK 17 as follows<\/p>\n<pre><strong>$ sudo apt install openjdk-17-jre openjdk-17-jdk<\/strong><\/pre>\n<p>This installs all the OPenJDK packages, libraries and dependencies. Once completed, go ahead and confirm that OpenJDK 17 is installed.<\/p>\n<pre><strong>$ sudo apt-cache policy openjdk-17-jre openjdk-17-jdk<\/strong><\/pre>\n<p>You should get some output similar to what we have below.<\/p>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"777\" height=\"284\" class=\"wp-image-11659\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-665.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-665.png 777w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-665-300x110.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-665-768x281.png 768w\" sizes=\"auto, (max-width: 777px) 100vw, 777px\" \/><\/strong><\/p>\n<p>Additionally, confirm that Java is installed as shown<\/p>\n<pre><strong>$ java --version<\/strong><\/pre>\n<p><strong><img loading=\"lazy\" decoding=\"async\" width=\"662\" height=\"114\" class=\"wp-image-11660\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-666.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-666.png 662w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-666-300x52.png 300w\" sizes=\"auto, (max-width: 662px) 100vw, 662px\" \/><\/strong><\/p>\n<h2><strong>Manually install Java 17 from a Tarball file<\/strong><\/h2>\n<p>The other way of installing OpenJDK 17 is by manually installing it from a Tarball file. This method gives you more freedom and flexibility to determine where it is installed.<\/p>\n<p>To manually install OpenJDK 17, follow the steps below.<\/p>\n<h3><strong>Step 1: Install dependencies<\/strong><\/h3>\n<p>First off, install a few dependencies that will be needed during the manual installation as shown.<\/p>\n<pre><strong>$ sudo apt install libc-i386 libc6-x32 curl -y<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"809\" height=\"224\" class=\"wp-image-11661\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-667.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-667.png 809w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-667-300x83.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-667-768x213.png 768w\" sizes=\"auto, (max-width: 809px) 100vw, 809px\" \/><\/p>\n<h3><strong>Step 2: Download OpenJDK 11 tarball file<\/strong><\/h3>\n<p>Next, visit the <a href=\"https:\/\/www.oracle.com\/java\/technologies\/downloads\/#JDK17\">Oracle Downloads page<\/a> and grab the OpenJDK 17 tarball file.<\/p>\n<pre><strong>$ curl -O https:\/\/download.oracle.com\/java\/17\/latest\/jdk-17_linux-x64_bin.tar.gz<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"841\" height=\"186\" class=\"wp-image-11662\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-668.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-668.png 841w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-668-300x66.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-668-768x170.png 768w\" sizes=\"auto, (max-width: 841px) 100vw, 841px\" \/><\/p>\n<p>When the download is complete, Extract the compressed file.<\/p>\n<pre><strong>$ tar -xvf jdk-17_linux-x64_bin.tar.gz<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"762\" height=\"124\" class=\"wp-image-11663\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-669.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-669.png 762w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-669-300x49.png 300w\" sizes=\"auto, (max-width: 762px) 100vw, 762px\" \/><\/p>\n<h3><strong>Step 3: Configure and install Java 17<\/strong><\/h3>\n<p>To install Java 17, move the JDK folder to the <strong> \/opt\/ <\/strong> path and give it an easy and convenient name. Here, we have renamed it <strong>jdk17.<\/strong><\/p>\n<pre><strong>$ sudo mv jdk-17.0.1 \/opt\/jdk17<\/strong><\/pre>\n<p>Finally, define the environment variables using the <strong>export <\/strong>command.<\/p>\n<pre><strong>$ export JAVA_HOME=\/opt\/jdk-17<\/strong><\/pre>\n<pre><strong>$ export PATH=$PATH:$JAVA_HOME\/bin<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"764\" height=\"183\" class=\"wp-image-11664\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-670.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-670.png 764w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-670-300x72.png 300w\" sizes=\"auto, (max-width: 764px) 100vw, 764px\" \/><\/p>\n<p>Double-check the version of Java installed using the command:<\/p>\n<pre><strong>$ java --version<\/strong><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"688\" height=\"135\" class=\"wp-image-11665\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-671.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-671.png 688w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-671-300x59.png 300w\" sizes=\"auto, (max-width: 688px) 100vw, 688px\" \/><\/p>\n<p>Wonderful, Java 17 is successfully installed on your server.<\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>Given the two methods that we have outlined, you can seamlessly install the latest OpenJDK, and by extension Java 17 &#8211; by the time of writing this guide &#8211; on your Debian 11 instance.<\/p>","protected":false},"excerpt":{"rendered":"<p>JDK 17 is finally out and was released on 14, September 2021 with lots of new features on the table. It is the latest LTS version of OpenJDK&hellip;<\/p>","protected":false},"author":1,"featured_media":11734,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[521,331],"class_list":["post-11658","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian","tag-debian-11","tag-java"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/11658","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=11658"}],"version-history":[{"count":1,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/11658\/revisions"}],"predecessor-version":[{"id":11733,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/11658\/revisions\/11733"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/11734"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=11658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=11658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=11658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}