Install Java on Centos 7

Java is a powerful programming language, software written in Java can be compiled and run on any system. Unlike Python and C, Java is not pre-installed on Linode's distribution images. OpenJDK is a free and open source alternative to the Java SE Development Kit (JDK, Java Standard Edition Development Kit). This article describes how to install the OpenJDK 8 operating environment and development kit on CentOS 7.

before the start##

  1. Read the Getting Started Guide, and set the Linode hostname and time zone.

  2. This article will try to use the sudo command as much as possible.

  3. Update system:

sudo yum update

Install Java Runtime Environment (JRE)

If you don't plan to use Java to write software, but just want to run programs written in Java, then we only need JRE. In CentOS, the JRE package name is java-$(version)-openjdk. The openjdk-headless package contains a minimal implementation for the JDK, allowing us to execute Java applications on the command line. Enter the following command to install the minimum version of OpenJDK 8

sudo yum install java-1.8.0-openjdk-headless

After the installation is complete, enter yum list installed | grep "java" to see if the installation is successful. The output should be similar to:

java-1.8.0-openjdk-headless.x86_64   1:1.8.0.131-3.b12.el7_3           @updates
javapackages-tools.noarch            3.4.1-11.el7                      @base
python-javapackages.noarch           3.4.1-11.el7                      @base
tzdata-java.noarch                   2017b-1.el7                       @updates

Install Java Development Kit (JDK)

If you plan to use Java to compile programs on Linode or other computers, you need to install JDK at this time.

sudo yum install java-1.8.0-openjdk-devel

After the installation is complete, enter yum list installed | grep "openjdk-devel" to see if the installation is successful. The output should be similar to:

java-1.8.0-openjdk-devel.x86_64      1:1.8.0.131-3.b12.el7_3           @updates

You can also verify the success of the installation by running the Java compiler javac. For example, if we want to compile a foobar.java file, run javac foobar.java to compile foobar.java. Then, run java foobar to execute the compiled foobar executable file.

More information##

For more information about this article, refer to the following resources.

Recommended Posts

Install Java on Centos 7
CentOS 7 install Java 1.8
CentOS 7 install Java 1.8
How to install Java on CentOS 8
Install Docker on Centos7
install LNMP on centos7.4
Nodejs install on centos7
Install FFmpeg on CentOS 8
Install RabbitMQ on CentOS 7
Install Node.js on Centos
Maven install on centos7
Install MongoDB on CentOS 7
Install Surelog on CentOS8
Openjdk install on centos7
Install Jenkins on centos7
install RabbitMQ on centos
Install RabbitMQ on CentOS 7
install Docker on centos6.5
install oracle on centos
Install Elasticsearch 6 on centos7
Install RabbitMQ on CentOS7
Install mysql online on centos
Install ElasticSearch 7.x on CentOS 7
CentOS 7 install JAVA environment (JDK 1.8)
CentOS6.5 install Java 8 and Tomcat8
Install MySQL 8.0.16 on Linux Centos
Install docker transfer on Centos7
Install Oracle Java8 on Ubuntu
Install docker on Centos system
Install Java JDK8 under CentOS6
install EPEL repo on centos
CentOS6.5 install Java 8 and Tomcat8
CentOS6.5 install Java 8 and Tomcat8
1.5 Install Centos7
Install Zabbix 3.4 based on CentOS 7
install virtualbox on centos server
Install Nginx server on CentOS 7
How to install MySQL on CentOS 8
Install JDK8 in rpm on CentOS7
How to install Java on Ubuntu 20.04
How to install Memcached on CentOS 8
Install MATE or XFCE on CentOS 7
How to install R on CentOS 8
How to install FFmpeg on CentOS 8
How to install Virtualbox on CentOS 8
How to install TensorFlow on CentOS 8
How to install TeamViewer on CentOS 8
How to install Perl 5 on CentOS
Tencent Cloud Centos7 install java server
How to install Git on CentOS 8
How to install Gradle on CentOS 8
How to install Elasticsearch on CentOS 8
How to install Jenkins on CentOS 8
How to install Go on CentOS 8
CentOS8 install jdk8 / java8 tutorial (recommended)
Tencent Cloud Centos7 install java server
How to install GCC on CentOS 8
How to install Yarn on CentOS 8
Install java in yum mode in Centos
How to install Nginx on CentOS 8
How to install Asterisk on CentOS 7