{"id":7119,"date":"2019-01-03T17:03:41","date_gmt":"2019-01-03T17:03:41","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=7119"},"modified":"2019-01-08T11:13:25","modified_gmt":"2019-01-08T11:13:25","slug":"how-to-install-java-on-centos-7","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/01\/03\/how-to-install-java-on-centos-7\/","title":{"rendered":"How to Install Java on CentOS 7"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/linux4one.com\/wp-content\/uploads\/2018\/12\/How-to-install-Java-on-CentOS-7-1.jpg\" alt=\"How to install Java on CentOS 7\" width=\"750\" height=\"350\" \/>How to install Java on CentOS 7<\/p>\n<p>Java is the popular programming language owned by Oracle. Java is used to build cross-platform applications. Over 3 billion devices run on Java. In this tutorial, we are going to install Java on CentOS 7 using different methods.<\/p>\n<p>Java has following three editions:<\/p>\n<ol>\n<li>Standard Edition(SE).<\/li>\n<li>Micro Edition(ME).<\/li>\n<li>Enterprize Edition(EE).<\/li>\n<\/ol>\n<p>Following two implementations available for Java:<\/p>\n<ol>\n<li>Oracle Java.<\/li>\n<li>OpenJDK Java.<\/li>\n<\/ol>\n<p>In this tutorial we are going to install Standard Edition (SE). There is no more difference in Oracle Java and OpenJDK Java as Oracle Java provides some additional enterprise features.<\/p>\n<h3>Prerequisites<\/h3>\n<p>Before you start to install Java on CentOS 7. You must have the non-root user account on your system with sudo privileges.<\/p>\n<p>You should have curl package installed on your system. We are going to use curl package to download Oracle JRE\/JDK from their official website. Install it by using following command.<\/p>\n<p>sudo yum install curl<\/p>\n<h3>Install OpenJDK 8<\/h3>\n<p>Currentally, OpenJDK 8 is the latest LTS version of OpenJDK. Here we are going to install it with yum package manager.<\/p>\n<h4>Install OpenJDK 8 JRE<\/h4>\n<p>To install OpenJDK 8 JRE package run following command.<\/p>\n<p><u>NOTE : If you have installed OpenJDK 8 JDK then we do not need to install OpenJDK 8 JRE As JRE is the subset of JDK.<\/u><\/p>\n<p>sudo yum install java-1.8.0-openjdk<\/p>\n<h4>Install OpenJDK 8 JDK<\/h4>\n<p>Run the following command to install OpenJDK 8 using yum package manager:<\/p>\n<p>sudo yum install java-1.8.0-openjdk-devel<\/p>\n<p>Confirm the installation and check the version typing following command.<\/p>\n<p>java -version<\/p>\n<h3>Install OpenJDK 7<\/h3>\n<h4>Install OpenJDK 7 JDK<\/h4>\n<p>Run the following command to install OpenJDK 7 using yum package manager:<\/p>\n<p>sudo yum install java-1.8.0-openjdk-devel<\/p>\n<h4>Install OpenJDK 7 JRE<\/h4>\n<p>To install OpenJDK 7 JRE package run following command.<\/p>\n<p><u>NOTE : If you have installed OpenJDK 7 JDK then we do not need to install OpenJDK 8 JRE As JRE is the subset of JDK.<\/u><\/p>\n<p>sudo yum install java-1.8.0-openjdk<\/p>\n<h3>Install Oracle Java 8<\/h3>\n<p>At the time writing this tutorial Oracle Java 8 is the latest LTS version of Oracle Java. Now to install Oracle Java 8 follow the instractions given below.<\/p>\n<h4>Install Oracle JRE 8<\/h4>\n<p>To download and install Oracle JRE 8 run following commands:<\/p>\n<p>curl -L -b &#8220;oraclelicense=a&#8221; -O http:\/\/download.oracle.com\/otn-pub\/java\/jdk\/8u162-b12\/0da788060d494f5095bf8624735fa2f1\/jre-8u162-linux-x64.rpmsudo yum localinstall jre-8u162-linux-x64.rpm<\/p>\n<h4>Install Oracle JDK 8<\/h4>\n<p>Now to install Oracle JDK 8 you can run following commands:<\/p>\n<p>curl -L -b &#8220;oraclelicense=a&#8221; -O http:\/\/download.oracle.com\/otn-pub\/java\/jdk\/8u162-b12\/0da788060d494f5095bf8624735fa2f1\/jdk-8u162-linux-x64.rpmsudo yum localinstall jdk-8u162-linux-x64.rpm<\/p>\n<h3>Install Oracle Java 9<\/h3>\n<p>If you want to install Oracle Java 9 then you can use following instractions.<\/p>\n<h4>Install Oracle JRE 9<\/h4>\n<p>To download and install Oracle JRE 9 run following commands:<\/p>\n<p>curl -L -b &#8220;oraclelicense=a&#8221; -O http:\/\/download.oracle.com\/otn-pub\/java\/jdk\/9.0.4+11\/c2514751926b4512b076cc82f959763f\/jre-9.0.4_linux-x64_bin.rpmsudo yum localinstall jre-9.0.4_linux-x64_bin.rpm<\/p>\n<h4>Install Oracle JDK 9<\/h4>\n<p>Now to download and install Oracle JDK 9 you can run following commands:<\/p>\n<p>curl -L -b &#8220;oraclelicense=a&#8221; -O http:\/\/download.oracle.com\/otn-pub\/java\/jdk\/9.0.4+11\/c2514751926b4512b076cc82f959763f\/jdk-9.0.4_linux-x64_bin.rpmsudo yum localinstall jdk-9.0.4_linux-x64_bin.rpm<\/p>\n<h3>Setting up default Java Version<\/h3>\n<p>If you have installed multiple versions of Java on your system then you can change the default version running following command.<\/p>\n<p>Check Current Java Version running following command.<\/p>\n<p>java -version<\/p>\n<p>Now to change default Java version run following command.<\/p>\n<p>sudo alternatives &#8211;config java<\/p>\n<p>The output should be:<\/p>\n<p>There is 1 choice for the alternative java (providing \/usr\/bin\/java).<\/p>\n<p>Selection Path Priority Status<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n0 \/usr\/lib\/jvm\/java-8-oracle\/jre\/bin\/java 1081 auto mode<br \/>\n1 \/usr\/lib\/jvm\/java-8-oracle\/jre\/bin\/java 1081 manual mode<br \/>\n* 2 \/usr\/local\/oracle-java-10\/jdk-10.0.2\/bin\/java 1500 manual mode<\/p>\n<p>Press to keep the current choice[*], or type selection number:<\/p>\n<p><u> NOTE: To change version just enter the number in the selection column and hit ENTER<\/u><\/p>\n<h3>Conclusion<\/h3>\n<p>You have successfully learned How to install Java on CentOS 7. If you have any queries regarding this then please don\u2019t forget to comment below.<\/p>\n<p><a href=\"http:\/\/lxer.com\/module\/newswire\/ext_link.php?rid=264396\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to install Java on CentOS 7 Java is the popular programming language owned by Oracle. Java is used to build cross-platform applications. Over 3 billion devices run on Java. In this tutorial, we are going to install Java on CentOS 7 using different methods. Java has following three editions: Standard Edition(SE). Micro Edition(ME). Enterprize &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/01\/03\/how-to-install-java-on-centos-7\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Install Java on CentOS 7&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7119","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/7119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=7119"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/7119\/revisions"}],"predecessor-version":[{"id":7437,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/7119\/revisions\/7437"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=7119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=7119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=7119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}