{"id":14063,"date":"2023-04-21T07:56:47","date_gmt":"2023-04-21T07:56:47","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=14063"},"modified":"2023-04-28T09:46:22","modified_gmt":"2023-04-28T09:46:22","slug":"how-to-install-java-development-kit-jdk-on-centos","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-install-java-development-kit-jdk-on-centos\/","title":{"rendered":"How to Install Java Development Kit (JDK) on CentOS"},"content":{"rendered":"<p>Java Development Kit (JDK) is a software development environment used for developing Java applications and applets. It includes the Java Runtime Environment (JRE), a compiler (javac), a documentation generator (javadoc), and other development tools. Installing the JDK on your CentOS system allows you to develop, compile, and run Java applications.<\/p>\n<p>In this step-by-step guide, we will show you how to install the Java Development Kit (JDK) on a CentOS system. We will cover the installation process for both OpenJDK, an open-source implementation of the Java Platform, and Oracle JDK, the official Java development kit from Oracle.<\/p>\n<h2>Step 1: Update Your System<\/h2>\n<p>Before installing the JDK, it&#8217;s a good idea to update your system packages to ensure you&#8217;re working with the latest software. Run the following command to update your CentOS system:<\/p>\n<pre>\r\nsudo yum update -y\r\n<\/pre>\n<h2>Step 2: Install OpenJDK or Oracle JDK<\/h2>\n<p>You can choose to install either OpenJDK or Oracle JDK, depending on your requirements.<\/p>\n<p><b>Install OpenJDK<\/b><\/p>\n<p>To install OpenJDK, run the following command:<\/p>\n<pre>\r\nsudo yum install -y java-11-openjdk-devel\r\n<\/pre>\n<p>Replace &#8220;11&#8221; with the desired version of OpenJDK, if needed.<\/p>\n<p><b>Install Oracle JDK<\/b><\/p>\n<p>To install Oracle JDK, follow these steps:<\/p>\n<p>Download the latest Oracle JDK from the official Oracle website: https:\/\/www.oracle.com\/java\/technologies\/javase-jdk11-downloads.html<\/p>\n<p>Upload the downloaded tarball (e.g., jdk-11.x.x_linux-x64_bin.tar.gz) to your CentOS system.<\/p>\n<p>Extract the tarball and move the extracted directory to \/opt:<\/p>\n<pre>\r\nsudo tar -xf jdk-11.x.x_linux-x64_bin.tar.gz\r\nsudo mv jdk-11.x.x \/opt\/jdk11\r\n<\/pre>\n<p>Replace &#8220;11.x.x&#8221; with the actual version numbers.<\/p>\n<p>Set the necessary environment variables:<\/p>\n<pre>\r\necho 'export JAVA_HOME=\/opt\/jdk11' | sudo tee \/etc\/profile.d\/jdk11.sh\r\necho 'export PATH=$PATH:$JAVA_HOME\/bin' | sudo tee -a \/etc\/profile.d\/jdk11.sh\r\nsource \/etc\/profile.d\/jdk11.sh\r\n<\/pre>\n<h2>Step 3: Verify the Installation<\/h2>\n<p>To verify that the JDK has been installed correctly, run the following command:<\/p>\n<pre>\r\njava -version\r\n<\/pre>\n<p>This command will display the installed JDK version and its details.<\/p>\n<h2>Commands Mentioned:<\/h2>\n<ul>\n<li><span class=\"fw-bold\">yum update<\/span> &#8211; Update installed packages on CentOS<\/li>\n<li><span class=\"fw-bold\">yum install<\/span> &#8211; Install specified packages and their dependencies on CentOS<\/li>\n<li><span class=\"fw-bold\">tar<\/span> &#8211; Extract or create compressed files<\/li>\n<li><span class=\"fw-bold\">mv<\/span> &#8211; Move or rename files and directories<\/li>\n<li><span class=\"fw-bold\">echo<\/span> &#8211; Print a string to the terminal or a file<\/li>\n<li><span class=\"fw-bold\">tee<\/span> &#8211; Redirect output to multiple destinations<\/li>\n<li><span class=\"fw-bold\">source<\/span> &#8211; Execute the contents of a file in the current shell<\/li>\n<li><span class=\"fw-bold\">java<\/span> &#8211; Launch a Java application or display Java information<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>In this guide, we have demonstrated how to install the Java Development Kit (JDK) on a CentOS system, covering both OpenJDK and Oracle JDK options. By following the steps outlined in this guide, you have successfully set up your CentOS system for Java application development.<\/p>\n<p>It&#8217;s important to keep your JDK installation up to date, as new versions often include security patches, bug fixes, and performance improvements. Regularly check the official OpenJDK or Oracle websites for updates, and apply them as needed to maintain a secure and efficient development environment.<\/p>\n<p>With the JDK installed, you can now develop, compile, and run Java applications on your CentOS system. To further improve your Java development experience, consider installing an integrated development environment (IDE) like Eclipse or IntelliJ IDEA, which offers advanced code editing, debugging, and refactoring features.<\/p>\n<p>We hope this guide has helped you successfully install the Java Development Kit (JDK) on your CentOS system. If you have any questions, comments, or suggestions for improvement, please feel free to share your thoughts in the comments section below. Your feedback is invaluable to us, and it helps us create better and more informative content for our users.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Java Development Kit (JDK) is a software development environment used for developing Java applications and applets. It includes the Java Runtime Environment (JRE), a compiler (javac), a documentation generator (javadoc),&#8230;<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[2055,996],"tags":[1244,1975,2214,1524,2029,2030],"class_list":["post-14063","post","type-post","status-publish","format-standard","hentry","category-centos","category-linux","tag-centos","tag-install","tag-java","tag-jdk","tag-openjdk","tag-oracle-jdk"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/14063","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=14063"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/14063\/revisions"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=14063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=14063"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=14063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}