{"id":48442,"date":"2025-03-19T12:45:40","date_gmt":"2025-03-19T12:45:40","guid":{"rendered":"https:\/\/ubuntuhandbook.org\/?p=48442"},"modified":"2026-10-02T11:41:17","modified_gmt":"2026-10-02T11:41:17","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 27 in Ubuntu 26.04, 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 2 on Sep 15, 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, and 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 27 from official tarball<\/h3>\n<p><b>NOTE: The steps below will override Oracle JDK 27 if it&#8217;s also installed via tarball.<\/b><\/p>\n<p><b>1.<\/b> To install the new OpenJDK JDK 27, 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\/27\/\" target=\"_blank\" rel=\"noreferrer noopener\">Download OpenJDK 27<\/a><\/div>\n<\/div>\n<p>Then select download the &#8220;Linux\u200a\/\u200ax64&#8221; build for modern AMD\/Intel platform, or &#8220;Linux\u200a\/\u200aAArch64&#8221; for ARM devices (e.g., Raspberry Pi or Snapdragon X Elite).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-52140\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/down-openjdk27-700x495.webp\" alt=\"\" width=\"610\" height=\"431\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/down-openjdk27-700x495.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/down-openjdk27-300x212.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/down-openjdk27-768x543.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/down-openjdk27.webp 1066w\" 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 27 tarball into that directory:\n<pre>sudo tar -zxf ~\/Downloads\/openjdk-27*_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-27<\/b> (or jdk-27.0.1, jdk-27.0.2, etc as time goes on) sub-folder.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-52141\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/extract-openjdk27-700x390.webp\" alt=\"\" width=\"610\" height=\"340\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/extract-openjdk27-700x390.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/extract-openjdk27-300x167.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/extract-openjdk27-768x428.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/extract-openjdk27.webp 1052w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/p>\n<p><b>3. Set OpenJDK JDK 27 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-27\/bin\/java 1<\/pre>\n<pre>sudo update-alternatives --install \/usr\/bin\/javac javac \/usr\/lib\/jvm\/jdk-27\/bin\/javac 1<\/pre>\n<pre>sudo update-alternatives --install \/usr\/bin\/jar jar \/usr\/lib\/jvm\/jdk-27\/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-27\/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 27. In the case, you&#8217;ll need to replace &#8220;jdk-27&#8221; in command with &#8220;jdk-27.0.1&#8221; or &#8220;jdk-27.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-52142\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/install-open27alter-700x428.webp\" alt=\"\" width=\"610\" height=\"373\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/install-open27alter-700x428.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/install-open27alter-300x184.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/install-open27alter-768x470.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/install-open27alter.webp 897w\" 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-52143\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/set-open27default-700x484.webp\" alt=\"\" width=\"610\" height=\"422\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/set-open27default-700x484.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/set-open27default-300x207.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/set-open27default-768x531.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/set-open27default.webp 897w\" 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-52144\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/openjdk27-version-700x484.webp\" alt=\"\" width=\"610\" height=\"422\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/openjdk27-version-700x484.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/openjdk27-version-300x207.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/openjdk27-version-768x531.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2025\/03\/openjdk27-version.webp 897w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/p>\n<h3>Uninstall OpenJDK JDK 25 or 27<\/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 27 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-27<\/pre>\n<p>Then, remove the alternative links:<\/p>\n<pre>sudo update-alternatives --remove java \/usr\/lib\/jvm\/jdk-27\/bin\/java<\/pre>\n<pre>sudo update-alternatives --remove javac \/usr\/lib\/jvm\/jdk-27\/bin\/javac<\/pre>\n<pre>sudo update-alternatives --remove jar \/usr\/lib\/jvm\/jdk-27\/bin\/jar<\/pre>\n<p>Also run similar command above for other executable files if added. And, replace <b>jdk-27<\/b>\u00a0with <b>jdk-27.0.1<\/b> etc. for point releases.<\/p>","protected":false},"excerpt":{"rendered":"<p>OpenJDK announced the latest JDK 2 on Sep 15, 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}]}}