{"id":6283,"date":"2015-05-19T12:00:36","date_gmt":"2015-05-19T04:00:36","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=6283"},"modified":"2023-04-28T09:47:12","modified_gmt":"2023-04-28T09:47:12","slug":"how-to-install-java-8-jdk-8u45-on-centos-6-centos-7","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-install-java-8-jdk-8u45-on-centos-6-centos-7\/","title":{"rendered":"How to Install JAVA 8 (JDK 8u45) on CentOS 6 \/ CentOS 7"},"content":{"rendered":"<h2>Introduction:<\/h2>\n<p>Java is a popular programming language used for developing web applications, desktop applications, and mobile applications. To run Java applications on your CentOS 6 or CentOS 7 system, you need to install Java Development Kit (JDK). In this guide, we will outline the steps to install JDK 8u45 on CentOS 6 and CentOS 7.<\/p>\n<h2>Step 1: Update the System<\/h2>\n<p>Before installing JDK, you need to update your system by running the following command:<\/p>\n<pre>\r\nsudo yum update\r\n<\/pre>\n<h2>Step 2: Download JDK 8u45<\/h2>\n<p>Next, you need to download JDK 8u45 from the Oracle website. You can do this by running the following command:<\/p>\n<pre>\r\nwget --no-cookies --no-check-certificate --header \"Cookie: oraclelicense=accept-securebackup-cookie\" \"https:\/\/download.oracle.com\/otn-pub\/java\/jdk\/8u45-b14\/jdk-8u45-linux-x64.tar.gz\"\r\n<\/pre>\n<h2>Step 3: Install JDK 8u45<\/h2>\n<p>Once you have downloaded JDK 8u45, you can proceed with the installation by running the following commands:<\/p>\n<pre>\r\nsudo mkdir -p \/usr\/java\/\r\nsudo tar -zxvf jdk-8u45-linux-x64.tar.gz -C \/usr\/java\/\r\n<\/pre>\n<h2>Step 4: Set Environment Variables<\/h2>\n<p>After the installation is complete, you need to set the environment variables for Java. You can do this by running the following commands:<\/p>\n<p>For CentOS 6:<\/p>\n<pre>\r\nsudo echo \"export JAVA_HOME=\/usr\/java\/jdk1.8.0_45\" >> \/etc\/bashrc\r\nsudo echo \"export PATH=\\$PATH:\\$JAVA_HOME\/bin\" >> \/etc\/bashrc\r\nsource \/etc\/bashrc\r\n<\/pre>\n<p>For CentOS 7:<\/p>\n<pre>\r\nsudo echo \"export JAVA_HOME=\/usr\/java\/jdk1.8.0_45\" >> \/etc\/profile\r\nsudo echo \"export PATH=\\$PATH:\\$JAVA_HOME\/bin\" >> \/etc\/profile\r\nsource \/etc\/profile\r\n<\/pre>\n<h2>Step 5: Verify JDK Installation<\/h2>\n<p>Finally, you can verify if JDK is installed correctly by running the following command:<\/p>\n<pre>\r\njava -version\r\n<\/pre>\n<p>If the installation is successful, you should see the version of JDK installed on your system.<\/p>\n<pre>\r\n# java -version\r\njava version \"1.8.0_45\"\r\nJava(TM) SE Runtime Environment (build 1.8.0_45-b14)\r\nJava HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)\r\n<\/pre>\n<h2>Commands Mentioned:<\/h2>\n<ul>\n<li><span class=\"fw-bold\">yum<\/span> &#8211; Yellowdog Updater Modified, a package manager for CentOS<\/li>\n<li><span class=\"fw-bold\">wget<\/span> &#8211; A command-line tool used to download files from the internet<\/li>\n<li><span class=\"fw-bold\">tar<\/span> &#8211; A command-line tool used to compress and extract files and directories<\/li>\n<li><span class=\"fw-bold\">echo<\/span> &#8211; A command-line tool used to print text to the terminal<\/li>\n<\/ul>\n<h2>Conclusion:<\/h2>\n<p>In this guide, we have outlined the steps to install JDK 8u45 on CentOS 6 and CentOS 7. By following these steps, you can now run Java applications on your system. If you encounter any issues during the installation process, feel free to comment or suggest improvements.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: Java is a popular programming language used for developing web applications, desktop applications, and mobile applications. To run Java applications on your CentOS 6 or CentOS 7 system, you&#8230;<\/p>\n","protected":false},"author":6,"featured_media":6287,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2055],"tags":[1251,1259,1975,2214,1524],"class_list":["post-6283","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","tag-centos-6","tag-centos-7-0","tag-install","tag-java","tag-jdk"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/6283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=6283"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/6283\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/6287"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=6283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=6283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=6283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}