{"id":274,"date":"2015-09-07T16:13:28","date_gmt":"2015-09-07T16:13:28","guid":{"rendered":"http:\/\/onlinelab.info\/?p=274"},"modified":"2015-09-07T16:13:28","modified_gmt":"2015-09-07T16:13:28","slug":"how-to-install-java-sdk-1-8-on-rhel-7-centos-7","status":"publish","type":"post","link":"https:\/\/www.asianux.org.vn\/index.php\/2015\/09\/07\/how-to-install-java-sdk-1-8-on-rhel-7-centos-7\/","title":{"rendered":"How to install Java SDK 1.8 on RHEL 7\/ CentOS 7"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-3248\" src=\"http:\/\/www.itzgeek.com\/wp-content\/uploads\/2012\/01\/Java.jpg\" alt=\"Java\" width=\"100\" height=\"100\" title=\"\"><\/p>\n<p>Today we will be looking into the installation of Oracle Java SDK 1.8_u5 on RHEL \/ CentOS, Java SDK is the most important base to the developers; this guide will be more useful for them to setup development environment when they especially uses Redhat or CentOS.<\/p>\n<h3><strong>Download Java SDK:<\/strong><\/h3>\n<p>You can either use command line or browser to download the JDK, better to use the browser, the easiest one. Visit the <a href=\"http:\/\/www.oracle.com\/technetwork\/java\/javase\/downloads\/jdk8-downloads-2133151.html\" target=\"_blank\" rel=\"nofollow noopener\">Oracle SDK<\/a> page to download. If you still want to use the command line, use the below command.<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"dos\"># wget --no-check-certificate --no-cookies --header \"Cookie: oraclelicense=accept-securebackup-cookie\" http:\/\/download.oracle.com\/otn-pub\/java\/jdk\/8u11-b12\/jdk-8u11-linux-x64.tar.gz<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"dos\"># tar -zxvf jdk-8u11-linux-x64.tar.gz\n\u00a0\n# \u00a0mv jdk1.8.0_11\/ \/usr\/<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h3><strong>Install Java:<\/strong><\/h3>\n<p>Once moved the java to the desired location, java must setup with the alternatives commands; this will install the java on your system.<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"dos\"># \/usr\/sbin\/alternatives --install \/usr\/bin\/java java \/usr\/jdk1.8.0_11\/bin\/java 2\n\u00a0\n# \/usr\/sbin\/alternatives --config java<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Select the latest java.<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"dos\">There are 2 programs which provide 'java'.\n\u00a0\n\u00a0 Selection\u00a0\u00a0\u00a0 Command\n-----------------------------------------------\n*+ 1\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/usr\/lib\/jvm\/java-1.7.0-openjdk-1.7.0.51-2.4.5.5.el7.x86_64\/jre\/bin\/java\n\u00a0\u00a0 2\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/usr\/jdk1.8.0_11\/bin\/java\n\u00a0\nEnter to keep the current selection[+], or type selection number: 2<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h3><strong>Verify the Java:<\/strong><\/h3>\n<p>Once setup the alternatives, verify the java version installed using the following command.<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"dos\"># java \u2013version\n\u00a0\njava version \"1.8.0_11\"\nJava(TM) SE Runtime Environment (build 1.8.0_11-b12)\nJava HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h3><strong>Setup Environmental Variable:<\/strong><\/h3>\n<p>The most important part has come now, it should be set before the installation of any java based applications.<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"dos\"># export JAVA_HOME=\/usr\/jdk1.8.0_11\/\n\u00a0\n# export JRE_HOME=\/usr\/jdk1.8.0_11\/jre\/<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Set PATH variable too.<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"code\">\n<pre class=\"dos\"># export PATH=$JAVA_HOME\/bin:$PATH<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>To set it as a permanent, place the above three commands in the \/etc\/profile (All Users) or .bash_profile (Single User)<\/p>\n<p>That\u2019s All!. Hope this helped, place your valuable comments below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today we will be looking into the installation of Oracle Java SDK 1.8_u5 on RHEL \/ CentOS, Java SDK is the most important base to the developers; this guide will be more useful for them&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-274","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts\/274","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/comments?post=274"}],"version-history":[{"count":0,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts\/274\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/media?parent=274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/categories?post=274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/tags?post=274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}