{"id":4620,"date":"2023-07-22T11:15:26","date_gmt":"2023-07-22T11:15:26","guid":{"rendered":"https:\/\/arzhost.com\/blogs\/?p=4620"},"modified":"2023-10-04T14:38:11","modified_gmt":"2023-10-04T14:38:11","slug":"install-java-11-12-on-centos-7","status":"publish","type":"post","link":"https:\/\/arzhost.com\/blogs\/install-java-11-12-on-centos-7\/","title":{"rendered":"How to Install Java 11 &#038; 12 on CentOS 7?"},"content":{"rendered":"<p>How to Install Java 11 &amp; 12 on CentOS 7? <a href=\"https:\/\/arzhost.com\/blogs\/how-to-install-java-on-raspberry-pi\/\">Java<\/a> is a very well-liked programming language that is used to create both desktop and lightweight mobile applications.<\/p>\n<p>This detailed tutorial will demonstrate how to set up Java on <a href=\"https:\/\/en.wikipedia.org\/wiki\/CentOS\">CentOS 7<\/a>.<\/p>\n<ol>\n<li>A user account with sudo privileges<\/li>\n<li>Access to the command line\/terminal window<\/li>\n<li>The yum package manager, included by default<\/li>\n<\/ol>\n<h2><strong>Versions of Java<\/strong><\/h2>\n<p><u>There are now four Java platforms accessible:<\/u><\/p>\n<ol>\n<li>Standard Edition of Java (Java SE)<\/li>\n<li>Micro Editions of Java (Java ME)<\/li>\n<li>Enterprise Edition of Java (Java EE)<\/li>\n<li>JavaFX<\/li>\n<\/ol>\n<p><span style=\"color: #000000;\"><strong>How to Install Java 11 &amp; 12 on CentOS 7?<\/strong> <\/span>In this paper, we examine various Java SE packages.<\/p>\n<p>Java Development Kit (Open JDK) and Java Runtime Environment are both free and open-source Java software programs (Open JRE). JDK is used for Java development and programming, whereas JRE is used to run Java-based applications.<\/p>\n<p>Another SE implementation that is available and includes additional commercial capabilities is Java Oracle. The official Oracle JDK can be found on the company&#8217;s website or in a third-party repository. But keep in mind that the program can only be used for non-commercial purposes under its license.<\/p>\n<h2><strong>CentOS Java Installation<\/strong><\/h2>\n<p>On your computer, you can install one or more Java packages. By installing a certain version number, you can also choose whatever version you want on your system. Java 11 is the Long-Term Support (LTS) version that is currently the default.<\/p>\n<h3><strong>1: Activate Openjdk 11<\/strong><\/h3>\n<p><u>1: Update the package repository to ensure you download the newest software:<\/u><\/p>\n<ul>\n<li><code>yum update sudo<\/code><\/li>\n<\/ul>\n<p><u>2: After that, run the Java Development Kit installation command as follows:<\/u><\/p>\n<ul>\n<li><code>Install Java 11-OpenJDK-Devel with sudo yum<\/code><\/li>\n<\/ul>\n<p><u>The downloaded and installed JDK is shown in the output, as seen in the illustration below:<\/u><\/p>\n<h3><strong>2: Activate OpenJRE 11<\/strong><\/h3>\n<p><u>A subset of OpenJDK is the Java Runtime Environment 11 (Open JRE 11). Consequently, the command includes both packages:<\/u><\/p>\n<ul>\n<li><code>Install Java 11-OpenJDK with sudo yum<\/code><\/li>\n<\/ul>\n<h3><strong>3: Oracle Java 11 installation<\/strong><\/h3>\n<p><u>1: Downloading the official Oracle JDK from the local repository is not possible. The.rpm package must be downloaded from the Java SE Downloads page.<\/u><\/p>\n<p><u>2: Java SE 12 is the most recent version. Oracle Java 11 is the most recent stable version, and it is LTS.<\/u><\/p>\n<ul>\n<li><code>On the website, find Java SE 11.0.3 (LTS) and click DOWNLOAD.<\/code><\/li>\n<\/ul>\n<p><u>3: Use the following command to install the package after the download is finished:<\/u><\/p>\n<ul>\n<li>use the command sudo yum local install jre-VERSION-linux-x64.rpm<\/li>\n<\/ul>\n<h2><strong>Make sure Java is set up on your computer<\/strong><\/h2>\n<p><iframe title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/d6UyvwFTGWM\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p><u>The command below displays your current Java release and verifies that the installation was successful:<\/u><\/p>\n<ul>\n<li><code>version of Java<\/code><\/li>\n<\/ul>\n<p>If Java was downloaded and installed properly, the output information should resemble the illustration below:<\/p>\n<h2><strong>Install a specific Java version<\/strong><\/h2>\n<p>By altering the command&#8217;s version number, you can also install any other version of Java.<\/p>\n<p><strong><u>1: Setup JDK 8<\/u><\/strong><\/p>\n<ul>\n<li><code>Instead of the usual OpenJDK 11, you might choose to use Open JDK 8.<\/code><\/li>\n<\/ul>\n<p>Enter the following command on the terminal to accomplish this:<\/p>\n<ul>\n<li><code>Install Java 1.8.0-openjdk-devel with sudo yum<\/code><\/li>\n<\/ul>\n<p><strong><u>2: Setup JRE 8<\/u><\/strong><\/p>\n<p>You can install Open JRE 8 as a part of Open JDK 8 by entering the command:<\/p>\n<ul>\n<li><code>Install Java 1.8.0-openjdk with sudo yum<\/code><\/li>\n<\/ul>\n<p><strong><u>3: Oracle Java 12 installation<\/u><\/strong><\/p>\n<p>You must download Oracle Java from its official page, as was already explained.<\/p>\n<p>Simply download the necessary package from their website, then continue with the installation to install the most recent version.<\/p>\n<h2><strong>Establishing the Default Java Version<\/strong><\/h2>\n<p>You can choose which version of Java is the default one since various versions of Java can be installed on your machine. To do that;<\/p>\n<p><u>Run the following command to view every installed version on your computer:<\/u><\/p>\n<ul>\n<li><code>alternatives to sudo \u2014config java<\/code><\/li>\n<\/ul>\n<p>Two alternatives to this approach are depicted in the graphic above. The Java 11 number 1, and the number 2, stand in for these options (Java 8).<\/p>\n<p>Enter the corresponding number (in this case, 1 or 2) to alter the default version.<\/p>\n<h2><strong>How to Set the Environment Variable JAVA HOME?<\/strong><\/h2>\n<p>Other applications built using this programming language can access Java&#8217;s installation location with ease by setting the JAVA HOME environment variable.<\/p>\n<p><u>1: Find the location of the Java installation:<\/u><\/p>\n<ul>\n<li><code>update-alternatives sudo java configuration<\/code><\/li>\n<\/ul>\n<p><u>You can find the path to each Java package that is installed on the system in the output.<\/u><\/p>\n<ul>\n<li><code>\/usr\/lib\/jvm\/java-11-openjdk-11.0.3.7-0.el7 6.x86 64\/bin\/java (where OpenJDK 11 is located)<\/code><\/li>\n<li><code>\/usr\/lib\/jvm\/java-1.8.0-openjdk-1.8.0.212.b04-0.el7 6.x86 64\/jre\/bin\/java (where OpenJDK 8 is located) (where OpenJDK 8 is located)<\/code><\/li>\n<\/ul>\n<p><u>2: Once you have seen every path, copy the one that corresponds to your desired Java version.<\/u><\/p>\n<p><u>3: Next, open any text editor and navigate to the. Bash profile. Here&#8217;s an illustration using vim:<\/u><\/p>\n<ul>\n<li><code>.bash profile for vim<\/code><\/li>\n<\/ul>\n<p><u>4: Include a line at the bottom of the file that describes the location of JAVA HOME as follows:<\/u><\/p>\n<ul>\n<li><code>JAVA HOME=\u201d\/your\/installation\/path\/\u201d<\/code><\/li>\n<\/ul>\n<p>For instance, if we copied the Java 11 installation path in the previous step, the text editor will now include the following line:<\/p>\n<ul>\n<li><code>\/usr\/lib\/jvm\/java-11-openjdk-11.0.3.7-0.el7 6.x86 64\/bin\/java<\/code><\/li>\n<\/ul>\n<h2><strong>How to Remove Java from CentOS?<\/strong><\/h2>\n<p>Use the yum delete command if you need to uninstall any of the installed Java packages.<\/p>\n<p><u>For instance, use the following command to get rid of Open JDK 8:<\/u><\/p>\n<ul>\n<li><code>Remove Java with sudo yum<\/code><\/li>\n<li><code>-1.8.0-openjdk-devel<\/code><\/li>\n<\/ul>\n<p>It will uninstall the package from CentOS if you press &#8220;y&#8221; to confirm the procedure, as shown in the screenshot below:<\/p>\n<ul>\n<li><code>\/usr\/lib\/jvm\/java-11-openjdk-11.0.3.7-0.el7 6.x86 64\/bin\/java<\/code><\/li>\n<\/ul>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>You have learned How to Install Java 11 &amp; 12 on CentOS 7 through this tutorial.<\/p>\n<p>We also spoke about configuring the home environment variable and modifying the default version. You are now prepared to begin using Java!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Install Java 11 &amp; 12 on CentOS 7? Java is a very well-liked programming language that is used to create both desktop and lightweight mobile applications. This detailed tutorial will demonstrate how to set up Java on CentOS 7. A user account with sudo privileges Access to the command line\/terminal window The yum [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6144,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[76],"tags":[],"class_list":["post-4620","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/4620","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/comments?post=4620"}],"version-history":[{"count":4,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/4620\/revisions"}],"predecessor-version":[{"id":6145,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/4620\/revisions\/6145"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/media\/6144"}],"wp:attachment":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/media?parent=4620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/categories?post=4620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/tags?post=4620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}