How to Install Java on CentOS Updated on January 4, 2024 by InMotion Hosting Contributor 1 Minutes, 46 Seconds to Read Java is required for running some games on your Linux VPS including Minecraft. The object-oriented programming language powers many websites and applications on computers and mobile devices. Below we cover how to: Install Java on CentOS Install OpenJDK Install Oracle JRE/JDK Check Java Download Version Uninstall Java You need root access to your linux server on your VPS or Dedicated server to continue. Install Java on CentOS The installation process consists of installing OpenJDK, the open source Java implementation which includes Font Renderer, or proprietary Oracle JRE/JDK with Flight Recorder which builds on top of OpenJDK. We recommend OpenJDK for the latest features. You may prefer Oracle JRE/JDK for stability. Install OpenJDK Log into SSH as root Search for the latest Java version: yum search openjdk Install the latest version. As of January 25, 2021: yum install java-11-openjdk You may see the following command afterward: There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).If so, run the following to finish incomplete commands:yum-complete-transaction --cleanup-onlyyum history redo last Install Oracle JRE/JDK Visit https://www.oracle.com/java/technologies/javase-downloads.html Select JDK Download for the latest Java SE version (version 15 as of January 25, 2021) Download the Linux RPM package (Optional) Verify the SHA256 checksum of the downloaded file on your Windows, Mac, or Linux machine against the checksum on the downloads page Upload the RPM file package to your server via cPanel, FTP, or SSH Install the RPM package as user root: yum install /path-to-file/jdk-[version].rpm Using Ansible? Consider using a Java Ansible role within your playbooks. Learn more about the possibilities with IT automation in our Ansible Education Channel. Check Java Download Version Check your Java status to ensure it’s installed correctly: java -version You should see similar results to below: Uninstall Java If you no longer need Java, uninstall the CentOS repo in SSH. Learn more about managing your linux server with our Managed VPS Hosting Product Guide. Share this Article InMotion Hosting Contributor Content Writer InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals! More Articles by InMotion Hosting Related Articles Getting Started with Managed VPS Hosting DNSSEC in cPanel Managed Servers for Better Security Securing Your VPS: 24 Ways to Harden Server Creating New Users in CentOS 7 Upgrade to VPS NVMe SSD Hosting How to Install Java on CentOS Check Your Server Information on a VPS or Dedicated Hosting account Getting Started With the ImunifyAV cPanel Plugin VPS Snapshots and the Best 5 Ways to Use Them VPS Hosting Technical Support Options