{"id":180929,"date":"2025-08-11T12:54:58","date_gmt":"2025-08-11T12:54:58","guid":{"rendered":"https:\/\/linuxiac.com\/?p=180929"},"modified":"2025-08-11T13:01:24","modified_gmt":"2025-08-11T13:01:24","slug":"how-to-install-java-on-almalinux-10","status":"publish","type":"post","link":"https:\/\/linuxiac.com\/how-to-install-java-on-almalinux-10\/","title":{"rendered":"How to Install Java on AlmaLinux 10: A Step-by-Step Guide"},"content":{"rendered":"\n<p>AlmaLinux is a rock-solid, server-focused distribution from the <a href=\"https:\/\/linuxiac.com\/what-is-enterprise-linux\/\">enterprise Linux<\/a> family\u2014perfect for anyone who wants a stable, predictable platform they can count on. And while it\u2019s built with servers in mind, it also works very well as a desktop system.<\/p>\n\n\n\n<p>Now, if you&#8217;re a Java developer or just need a reliable environment to run your Java applications and have chosen Alma 10 for a platform, the first question you&#8217;re probably asking is: <em>How do I install Java on AlmaLinux?<\/em> Well, you&#8217;re in the right place.<\/p>\n\n\n\n<p>In this guide, I\u2019ll walk you through the process step by step. Additionally, we\u2019ll also make sure your system is set up properly by covering how to configure the necessary environment variables so your Java installation is fully ready to go.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">OpenJDK vs. Oracle JDK<\/h2>\n\n\n\n<p>Before we get started, I want to clear something up. In other guides, you might see instructions for installing the Oracle version of Java. But here, I\u2019ve chosen not to cover that for a reason\u2014and here\u2019s why.<\/p>\n\n\n\n<p>First and foremost, the version of Java available in the AlmaLinux 10 repositories is licensed under GPLv2, which means it\u2019s completely free to use\u2014even for commercial purposes.<\/p>\n\n\n\n<p>Oracle\u2019s version, on the other hand, is distributed under their <a href=\"https:\/\/www.oracle.com\/downloads\/licenses\/no-fee-license.html\" target=\"_blank\" rel=\"noreferrer noopener\">No-Fee Terms and Conditions<\/a> (NFTC). While that may seem straightforward at first glance, there are some hidden caveats in the license that developers and organizations should be aware of before using it in production.<\/p>\n\n\n\n<p>First and foremost, no-fee is different from open source. I mean, Oracle JDK under NFTC is not open source, so you\u2019re\u00a0not allowed to modify or redistribute\u00a0the source code. In AlmaLinux, you can use Java commercially, modify it, and redistribute original or modified builds.<\/p>\n\n\n\n<p>With Oracle JDK, while it permits free internal and production use and redistribution of\u00a0unmodified\u00a0binaries, <strong>you can\u2019t distribute modified builds<\/strong>, and the no-fee period is\u00a0time-boxed per release line. So, in practice, Oracle implementation does not give you anything more &#8211; both share the same upstream, I mean, both are built from the OpenJDK code.<\/p>\n\n\n\n<p>With that said, the choice is pretty clear: OpenJDK. Now that we\u2019ve cleared that up, back to the main topic of this guide.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Choosing the Right Java Package in AlmaLinux 10<\/h2>\n\n\n\n<p>Before we jump into installing Java on AlmaLinux 10, there\u2019s one more thing worth clearing up\u2014picking the right OpenJDK package. The distro offers three main variants, so allow me to break down what each one does quickly. That way, you\u2019ll know exactly which one makes the most sense for your needs.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-01.jpg\"><img decoding=\"async\" width=\"1024\" height=\"344\" src=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-01-1024x344.jpg\" alt=\"OpenJDK package provided by AlmaLinux 10.\" class=\"wp-image-182555\" srcset=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-01-1024x344.jpg 1024w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-01-380x128.jpg 380w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-01-768x258.jpg 768w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-01.jpg 1092w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">OpenJDK package provided by AlmaLinux 10.<\/figcaption><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>java-21-openjdk<\/strong> (The Standard Runtime Environment): Provides the full Java runtime needed to run Java applications. So, if you want to run Java programs (including GUI-based apps) without doing any development, this is the way to go.<\/li>\n\n\n\n<li><strong>java-21-openjdk-headless<\/strong> (Minimal Runtime): A stripped-down runtime optimized for server or CLI environments. No GUI support \u2014 excludes AWT, Swing, and other X11 dependencies. It&#8217;s Ideal for environments where graphical components are unnecessary.<\/li>\n\n\n\n<li><strong>java-21-openjdk-devel<\/strong> (Development Tools): Provides the Java Development Kit (JDK) for compiling and building Java applications. If you plan to write, compile, or build Java applications rather than just run them, this is what you need.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Install Java on AlmaLinux 10<\/h2>\n\n\n\n<p>Based on all that, I\u2019d suggest going with the &#8220;<em>java-21-openjdk-devel<\/em>&#8221; package as your all-in-one solution. Even if you\u2019re not planning to compile Java apps yourself, it\u2019s still handy to have that capability ready to go. Plenty of services compile Java code on the fly while doing their work, so having this package installed makes life easier for most Java setups.<\/p>\n\n\n\n<p>Installing it couldn\u2019t be easier. Just a single <a href=\"https:\/\/linuxiac.com\/dnf-command-linux\/\" data-type=\"post\" data-id=\"47366\">DNF command<\/a>:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo dnf install java-21-openjdk-devel<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-02.jpg\"><img decoding=\"async\" width=\"1024\" height=\"606\" src=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-02-1024x606.jpg\" alt=\"Installing Java on AlmaLinux 10.\" class=\"wp-image-182564\" srcset=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-02-1024x606.jpg 1024w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-02-380x225.jpg 380w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-02-768x454.jpg 768w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-02.jpg 1089w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Installing Java on AlmaLinux 10.<\/figcaption><\/figure>\n\n\n\n<p>As you can see, installing &#8220;<em>java-21-openjdk-devel<\/em>&#8221; also automatically pulls in &#8220;<em>java-21-openjdk<\/em>,&#8221; and that in turn pulls in &#8220;<em>java-21-openjdk-headless<\/em>&#8221; as a dependency. So you end up with a full Java suite installed on your AlmaLinux 10 system.<\/p>\n\n\n\n<p>Once the packages are downloaded and installed, use the command provided below to verify that the installation was successful. It should output similar to the following:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">java -version<\/code><\/span><\/pre>\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-03.jpg\"><img decoding=\"async\" width=\"994\" height=\"141\" src=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-03.jpg\" alt=\"Verify the Java installation.\" class=\"wp-image-182573\" srcset=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-03.jpg 994w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-03-380x54.jpg 380w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-03-768x109.jpg 768w\" sizes=\"(max-width: 994px) 100vw, 994px\" \/><\/a><figcaption class=\"wp-element-caption\">Verify the Java installation.<\/figcaption><\/figure>\n\n\n\n<p>And that&#8217;s all. We now have OpenJDK 21 successfully installed on our AlmaLinux 10 system.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Set JAVA_HOME Environment Variable<\/h2>\n\n\n\n<p><span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\">You can think of the &#8220;<em>JAVA_HOME<\/em>&#8221; environment variable as a \u201ccontract\u201d in the Java ecosyste<\/span>m. It points to the root of a JDK\/JRE directory. Why do we need it?<\/p>\n\n\n\n<p>Various applications (for example, Maven, Gradle, Tomcat, Jenkins, and so on) use \u201c<em>JAVA_HOME<\/em>\u201d\u00a0to locate the JDK installation directory. On top of that, many CI\/CD pipelines, Docker images, and development environments also assume it is set. Without it, they might fail to start.<\/p>\n\n\n\n<p>You can easily find the right path for the &#8220;<em>JAVA_HOME<\/em>&#8221; variable by running the command below:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">readlink -f \/usr\/bin\/java | sed <span class=\"hljs-string\">\"s:bin\/java::\"<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-04.jpg\"><img decoding=\"async\" width=\"928\" height=\"96\" src=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-04.jpg\" alt=\"Finding the path for the &quot;JAVA_HOME&quot; variable.\" class=\"wp-image-182588\" srcset=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-04.jpg 928w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-04-380x39.jpg 380w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-04-768x79.jpg 768w\" sizes=\"(max-width: 928px) 100vw, 928px\" \/><\/a><figcaption class=\"wp-element-caption\">Finding the path for the &#8220;JAVA_HOME&#8221; variable.<\/figcaption><\/figure>\n\n\n\n<p>However, instead of going through the hassle of manually editing your &#8220;<em>~\/.bashrc<\/em>&#8221; file to add the path\u2014or temporarily exporting variables\u2014here\u2019s a simpler, automated way to make the change permanent. Execute the four lines below in the terminal:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo tee \/etc\/profile.d\/java.sh &gt; \/dev\/null &lt;&lt;<span class=\"hljs-string\">'EOF'<\/span>\n<span class=\"hljs-built_in\">export<\/span> JAVA_HOME=$(dirname $(dirname $(readlink -f $(<span class=\"hljs-built_in\">which<\/span> java))))\n<span class=\"hljs-built_in\">export<\/span> PATH=<span class=\"hljs-variable\">$JAVA_HOME<\/span>\/bin:<span class=\"hljs-variable\">$PATH<\/span>\nEOF<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Finally, make the &#8220;<em>java.sh<\/em>&#8221; file we just created executable.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo chmod +x \/etc\/profile.d\/java.sh<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-05.jpg\"><img decoding=\"async\" width=\"928\" height=\"165\" src=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-05.jpg\" alt=\"Setting up JAVA_HOME system-wide.\" class=\"wp-image-182594\" srcset=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-05.jpg 928w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-05-380x68.jpg 380w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-05-768x137.jpg 768w\" sizes=\"(max-width: 928px) 100vw, 928px\" \/><\/a><figcaption class=\"wp-element-caption\">Setting up JAVA_HOME system-wide.<\/figcaption><\/figure>\n\n\n\n<p>After logging out and back in, &#8220;<em>JAVA_HOME<\/em>&#8221; will always match the active Java version. A simple check:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\"><span class=\"hljs-built_in\">echo<\/span> <span class=\"hljs-variable\">$JAVA_HOME<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-06.jpg\"><img decoding=\"async\" width=\"928\" height=\"95\" src=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-06.jpg\" alt=\"Verify that JAVA_HOME is set correctly.\" class=\"wp-image-182597\" srcset=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-06.jpg 928w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-06-380x39.jpg 380w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-06-768x79.jpg 768w\" sizes=\"(max-width: 928px) 100vw, 928px\" \/><\/a><figcaption class=\"wp-element-caption\">Verify that JAVA_HOME is set correctly.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Uninstall Java on AlmaLinux 10<\/h2>\n\n\n\n<p>If, for some reason, you want to remove Java from your AlmaLinux 10 system, here&#8217;s how to approach it. First, use the command below to find out all locally installed Java packages.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">rpm -aq | grep openjdk<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-07.jpg\"><img decoding=\"async\" width=\"928\" height=\"143\" src=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-07.jpg\" alt=\"Finding the installed OpenJDK packages.\" class=\"wp-image-182606\" srcset=\"https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-07.jpg 928w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-07-380x59.jpg 380w, https:\/\/linuxiac.com\/wp-content\/uploads\/2025\/08\/almalinux-install-java-07-768x118.jpg 768w\" sizes=\"(max-width: 928px) 100vw, 928px\" \/><\/a><figcaption class=\"wp-element-caption\">Finding the installed OpenJDK packages.<\/figcaption><\/figure>\n\n\n\n<p>Then, just pass their names as arguments to the <code>dnf remove<\/code> command.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo dnf remove java-21-openjdk-headless java-21-openjdk java-21-openjdk-devel<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>And finally, make sure to delete the &#8220;<em>java.sh<\/em>&#8221; file you created earlier.&#8221;<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-8\" data-shcb-language-name=\"Bash\" data-shcb-language-slug=\"bash\"><span><code class=\"hljs language-bash\">sudo rm \/etc\/profile.d\/java.sh<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-8\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">Bash<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">bash<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>As you can see from this guide, installing Java on AlmaLinux 10 is simple and can be completed in minutes. Now, you are all set to run Java applications, develop Java programs, and enjoy the many benefits of this powerful programming language.<\/p>\n\n\n\n<p>Thanks for your time! I hope you find this guide helpful. Your feedback and comments are most welcome.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Quickly install Java on AlmaLinux 10 and configure JAVA_HOME for seamless application development and deployment.<\/p>\n","protected":false},"author":10,"featured_media":180932,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,4417],"tags":[3248,3748,3440],"class_list":["post-180929","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","category-linux-knowledge","tag-almalinux","tag-development","tag-java"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/posts\/180929","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/comments?post=180929"}],"version-history":[{"count":0,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/posts\/180929\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/media\/180932"}],"wp:attachment":[{"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/media?parent=180929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/categories?post=180929"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxiac.com\/wp-json\/wp\/v2\/tags?post=180929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}