
{"id":48442,"date":"2025-03-19T12:45:40","date_gmt":"2025-03-19T12:45:40","guid":{"rendered":"https:\/\/ubuntuhandbook.org\/?p=48442"},"modified":"2026-03-22T10:42:27","modified_gmt":"2026-03-22T10:42:27","slug":"install-openjdk-24-ubuntu","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2025\/03\/install-openjdk-24-ubuntu\/","title":{"rendered":"How to Install OpenJDK 25 LTS or 26 in Ubuntu 24.04 | 22.04"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/03\/java-logo.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-thumbnail wp-image-38208\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/03\/java-logo-250x250.png\" alt=\"\" width=\"250\" height=\"250\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/03\/java-logo-250x250.png 250w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/03\/java-logo-300x300.png 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/03\/java-logo-600x600.png 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/03\/java-logo-768x768.png 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/03\/java-logo.png 1200w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p>OpenJDK announced the latest JDK 26 on March 17, 2026. This is the beginner&#8217;s guide shows how to install it as well as the last 25 LTS in all current Ubuntu and Linux Mint releases.<\/p>\n<p>OpenJDK 25 is the Long Term Support release with 5-years support until 2030. Ubuntu has made JDK 25 into system repository for current releases, while user may also choose the official tarball for choice.<\/p>\n<p><!--more--><\/p>\n<div id=\"attachment_50379\" style=\"width: 620px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-50379\" class=\"size-large wp-image-50379\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/java-25-release-700x366.webp\" alt=\"\" width=\"610\" height=\"319\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/java-25-release-700x366.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/java-25-release-300x157.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/java-25-release-768x402.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/java-25-release.webp 770w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><p id=\"caption-attachment-50379\" class=\"wp-caption-text\">image from oracle.com<\/p><\/div>\n<h3>Difference between OpenJDK and Oracle JDK<\/h3>\n<p>OpenJDK and Oracle JDK are &#8220;same thing&#8221;, but with different licence.<\/p>\n<p>Oracle JDK is built from the OpenJDK JDK source, but non-opensource licence. While both OpenJDK source and the OpenJDK builds binaries are distributed under the same GPL2+CPE licence.<\/p>\n<p><b>Both are free!<\/b> Though, Oracle also offers a subscription for the Oracle JDK builds that user can buy for support! And, I&#8217;ve written about <a href=\"https:\/\/ubuntuhandbook.org\/index.php\/2022\/03\/install-jdk-18-ubuntu\/\" target=\"_blank\" rel=\"noopener\">how to install Oracle Java 21\/25<\/a> in Ubuntu.<\/p>\n<h3>Option 1: Install Open JDK 25 from System Repository<\/h3>\n<p>Ubuntu supports the long term support (LTS) OpenJDK releases. Like JDK 8, JDK 17, and JDK 21, the last OpenJDK 25 has been made into system repositories for Ubuntu 22.04, Ubuntu 24.04, Ubuntu 25.04\/25.10, and next Ubuntu 26.04.<\/p>\n<p>To install it, press <code>Ctrl+Alt+T<\/code> on keyboard to open terminal and run command:<\/p>\n<pre>sudo apt install openjdk-25-jdk<\/pre>\n<p>Run <code>sudo apt update<\/code> to refresh cache if failed. And you may replace <code>openjdk-25-jdk<\/code> with <code>openjdk-25-jre<\/code> for just run-time environment.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-50380\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/apt-jdk25-700x499.webp\" alt=\"\" width=\"610\" height=\"435\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/apt-jdk25-700x499.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/apt-jdk25-300x214.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/apt-jdk25.webp 722w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/p>\n<p>If you have multiple versions of Java installed, and JDK 25 is not set as default after installation, then you may run the command below and choose one to be default:<\/p>\n<pre>sudo update-alternatives --config java<\/pre>\n<p>Also replace <code>java<\/code> with <code>javac<\/code> or <code>jar<\/code> to set the defaults for other executables.<\/p>\n<h3>Option 2: Install OpenJDK JDK 26 from official tarball<\/h3>\n<p><b>NOTE: The steps below will override Oracle JDK 26 if it&#8217;s also installed via tarball.<\/b><\/p>\n<p><b>1.<\/b> To install the new OpenJDK JDK 26, first go to java website via the link below:<\/p>\n<div class=\"wp-block-buttons aligncenter\">\n<div class=\"wp-block-button is-style-fill\"><a class=\"wp-block-button__link has-vivid-cyan-blue-to-vivid-purple-gradient-background has-text-color has-background\" href=\"https:\/\/jdk.java.net\/26\/\" target=\"_blank\" rel=\"noreferrer noopener\">Download OpenJDK 26<\/a><\/div>\n<\/div>\n<p>Then select download the &#8220;Linux\u200a\/\u200ax64&#8221; build for AMD\/Intel platform, or &#8220;Linux\u200a\/\u200aAArch64&#8221; for ARM devices (e.g., Raspberry Pi or Snapdragon X).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-50801\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/download-openjdk26-700x488.webp\" alt=\"\" width=\"610\" height=\"425\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/download-openjdk26-700x488.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/download-openjdk26-300x209.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/download-openjdk26-768x535.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/download-openjdk26.webp 1140w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/p>\n<p><b>2.<\/b> After downloaded the Linux tarball, press <code>Ctrl+Alt+T<\/code> to open up a terminal window, and run commands below to extract to <code>\/usr\/lib\/jvm<\/code> directory.<\/p>\n<ul>\n<li>First, create the target directory in case this is the first time you install Java on the system.\n<pre>sudo mkdir -p \/usr\/lib\/jvm<\/pre>\n<\/li>\n<li>Then, run command to extract OpenJDK 26 tarball into that directory:\n<pre>sudo tar -zxf ~\/Downloads\/openjdk-26*_bin.tar.gz -C \/usr\/lib\/jvm\/<\/pre>\n<p>Here assume you saved the tarball in user Downloads folder.<\/li>\n<\/ul>\n<p>After that, run <code>ls \/usr\/lib\/jvm\/<\/code> to list directory content. It should include a new <b>jdk-25<\/b> (or jdk-25.0.1, jdk-25.0.2, etc) sub-folder.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-50802\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/openjdk26-tarball-700x415.webp\" alt=\"\" width=\"610\" height=\"362\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/openjdk26-tarball-700x415.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/openjdk26-tarball-300x178.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/openjdk26-tarball-768x455.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/openjdk26-tarball.webp 1012w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/p>\n<p><b>3. Set OpenJDK JDK 26 as default<\/b>.<\/p>\n<p>To set it as default, first run commands below one by one to link executable files as alternatives:<\/p>\n<pre>sudo update-alternatives --install \/usr\/bin\/java java \/usr\/lib\/jvm\/jdk-26\/bin\/java 1<\/pre>\n<pre>sudo update-alternatives --install \/usr\/bin\/javac javac \/usr\/lib\/jvm\/jdk-26\/bin\/javac 1<\/pre>\n<pre>sudo update-alternatives --install \/usr\/bin\/jar jar \/usr\/lib\/jvm\/jdk-26\/bin\/jar 1<\/pre>\n<p>As you see in the screenshot below, there are many other executable files under <code>\/usr\/lib\/jvm\/jdk-26\/bin<\/code> (e.g., javap, jdb, jfr, and more). You may run similar commands above for them one by one as you need.<\/p>\n<p><b>NOTE: As time goes on, OpenJDK may release updates for JDK 26. In the case, you&#8217;ll need to replace &#8220;jdk-26&#8221; in command with &#8220;jdk-26.0.1&#8221; or &#8220;jdk-26.0.2&#8221; according to the Java root folder name under &#8220;\/usr\/lib\/jvm&#8221;.<\/b><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-50803\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/install-openjdk26alters-700x460.webp\" alt=\"\" width=\"610\" height=\"401\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/install-openjdk26alters-700x460.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/install-openjdk26alters-300x197.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/install-openjdk26alters-768x505.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/install-openjdk26alters.webp 866w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/p>\n<p>After that, run the commands below one by one to choose default Java:<\/p>\n<pre>sudo update-alternatives --config java<\/pre>\n<pre>sudo update-alternatives --config javac<\/pre>\n<pre>sudo update-alternatives --config jar<\/pre>\n<p>Also run similar command above for other executable files if you created links for them.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-50804\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/updatealter-jdk26-700x523.webp\" alt=\"\" width=\"610\" height=\"456\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/updatealter-jdk26-700x523.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/updatealter-jdk26-300x224.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/updatealter-jdk26-768x574.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/updatealter-jdk26.webp 978w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/p>\n<p><b>4.<\/b> Finally, run command to check the default Java edition:<\/p>\n<pre>java --version<\/pre>\n<pre>javac --version<\/pre>\n<p>And, use <code>java -XshowSettings:properties -version<\/code> to print more the properties.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-50805\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/openjdk26-about-700x523.webp\" alt=\"\" width=\"610\" height=\"456\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/openjdk26-about-700x523.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/openjdk26-about-300x224.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/openjdk26-about-768x574.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/openjdk26-about.webp 978w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/p>\n<h3>Uninstall OpenJDK JDK 25 or 26<\/h3>\n<p>If you installed OpenJDK 25 from Ubuntu system repository, simply run the command below in terminal (Ctrl+Alt+T) to uninstall:<\/p>\n<pre>sudo apt remove --autoremove openjdk-25-jdk* openjdk-25-jre*<\/pre>\n<p>To uninstall OpenJDK JDK 26 installed via the Linux tarball, run command to remove the Java folder under <code>\/usr\/lib\/jvm<\/code>:<\/p>\n<pre>sudo rm -R \/usr\/lib\/jvm\/jdk-26<\/pre>\n<p>Then, remove the alternative links:<\/p>\n<pre>sudo update-alternatives --remove java \/usr\/lib\/jvm\/jdk-26\/bin\/java<\/pre>\n<pre>sudo update-alternatives --remove javac \/usr\/lib\/jvm\/jdk-26\/bin\/javac<\/pre>\n<pre>sudo update-alternatives --remove jar \/usr\/lib\/jvm\/jdk-26\/bin\/jar<\/pre>\n<p>Also run similar command above for other executable files if added. And, replace <b>jdk-26<\/b>\u00a0with <b>jdk-26.0.1<\/b> etc. for point releases.<\/p>","protected":false},"excerpt":{"rendered":"<p>OpenJDK announced the latest JDK 26 on March 17, 2026. This is the beginner&#8217;s guide shows how to install it as well as the last 25 LTS in all current Ubuntu and Linux Mint releases. OpenJDK 25 is the Long Term Support release with 5-years support until 2030. Ubuntu has made JDK 25 into system [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":38208,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[319],"class_list":["post-48442","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-openjdk"],"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/48442","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=48442"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/48442\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media\/38208"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=48442"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=48442"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=48442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}