+5 votes
425 views
How to install Java 8 or Java 13 on CentOS 8

in Linux / Unix by (552k points)
reopened | 425 views

1 Answer

+3 votes
Best answer

1. How to install Java 8 on CentOS 8
2. How to install Java 13 on CentOS 8

In the world of servers there are countless applications and utilities that are key to the proper and correct operation not only of the system and its applications , but also of many services with which the system will interact..

One of these utilities is Java which is widely known by web developers since Java is an ideal and versatile technology for the development of web applications facilitating both its implementation and its implementation.

Java is a multiplatform programming language in which it integrates Java Runtime Environment (JRE) and this in turn is composed of Java Virtual Machine (JVM) which defines the core classes of the Java platform and manages the libraries available for Java. JRE is responsible for applying the software runtime and this in turn be deployed in current web browsers ..

If you are still not convinced to install Java you should know that more than 90% of the equipment at the enterprise level make use of this software so the possibilities of scalability and performance are wide, some of its main features are:

features
  • Java provides us with the tools to write software on one platform and run it virtually on another platform.
  • Ability to develop server applications and HTML forms.
  • Combine various Java-based applications or services in order to create applications or services.
  • Develop programs to be run in a browser or web services.
  • Write applications for mobile phones, remote processors, microcontrollers, Gateways and millions of other devices.
What is Java 8?
TechnoWikis will speak on this opportunity of Java 8 which allows to improve the performance in development and execution of Java programs in any environment, some of its most outstanding features are:
  • Integrates a new date and time API.
  • It has the Nashhorn JavaScript engine.
  • Offers virtual extension methods and Lambda expression.
  • Your safety has been improved to optimize usage.

Next, we will explain in TechnoWikis how to install Java 8 on CentOS 8.

Note
Java 8 is not available for public download, so you'll see how to install Java 13 on CentOS 8 later.

1. How to install Java 8 on CentOS 8


In this case, Oracle offers Java RPM packages and compiled source code for installation, but since the official download is already available, it is better to use the Java SE Development Kit 8 source code.
Step 1

For this we will download the codes from the official Oracle site, there we can register for free to download:
Java 8
image
Step 2

There we can download either the .rpm file or the .tar.gz file. If we download the .tar.gz file we can visualize it using the ls command:

image

Step 3

We proceed to extract it by executing:
 sudo tar xzf jdk-8u221-linux-x64.tar.gz 

image

Step 4

We will use “ls” to verify that the directory has been created. We see that the directory created is “jdk1.8.0_221.

image

Step 5

Alternatively, we can install Java 8 by running the following:
 yum install java-1.8.0-openjdk 

image

Step 6

Enter the letter "s" to confirm the download:

image

Step 7

After this we will execute the following to install some dependencies:
 yum install java-1.8.0-opemjdk-devel 

image

Step 8

Again we enter the letter "s" to confirm the download and installation.

image

Step 9

Another option is to download the .rpm file from the official site and then run the following:
 yum localinstall jre-8u221-linux-x64.rpm 

image

Step 10

We accept the download and installation of Java 8 in CentOS 8:

image

Step 11

Java validation
We can verify that Java has been installed correctly by executing the following:
 java -version 

image

Assign the Java path
We will define the variable JAVA_HOME with the following command which allows us to define this route:
 update-alternatives --config java 

image

Step 12

There we must select the appropriate route and press Enter, after this we establish the route by executing:
 export JAVA_HOME = / usr / lib / jvm / java-1.8.0-openjdk-1.8.0.222.b10-0.el8_0.x86_64 / jre / bin / java 

image

Step 13

We check this by entering the following. There we check the assigned route.
 echo $ JAVA_HOME 

image

This is the process to install Java 8 on CentOS 8..


2. How to install Java 13 on CentOS 8

Step 1

Java 13 is the latest version of Oracle and will be compatible in the next 6 months and as you should know this new version integrates new features and improvements, some of these are:
News
  • The FileSystems.newFileSystem method was added.
  • New transfer methods java.nio.ByteBuffer Bulk get / put.
  • Supports Unicode 12.1
  • New raw string literals which use multiple lines of source code.
  • The maximum heap size of ZGC is 16 TB.
  • Readout time configurable for CRL.
  • It has support for MS Cryptography Next Generation (CNG)
  • Support for X25519 and X448 in TLS and many more.

The installation process of Java 13 on CentOS 8 is much simpler and you will see why, first, you can directly download the .rpm or .tar.gz file from the official Oracle link:

Java 13
Step 2

Or, from the terminal in CentOS 8 you can execute the following:
 wget --no-cookies --no-check-certificate --header "Cookie: oraclelicense = accept-securebackup-cookie" "https://download.oracle.com/otn-pub/java/jdk/13+33/ 5b8a42f3905b406298b72d750b6919f6 / jdk-13_linux-x64_bin.rpm " 
image
Step 3

Once this process is finished we will see the following: image
Step 4

The next step is to execute the downloaded file, for this we enter the following:
 rpm -Uvh jdk-13_linux-x64_bin.rpm 
image
Step 5

When this task is finished we can verify the Java version in CentOS 8 with the following command:
 java -version 
image
Step 6

Finally, since most Java-based applications make use of environment variables for their execution, it is necessary to define the Java environment variables with the following commands:
 export JAVA_HOME = / usr / java / jdk-13 (Define the JAVA_HOME variable) export PATH = $ PATH: / usr / java / jdk-13 / bin (Define the PATH variable) 
image

From this moment on you are ready to use Java 8 or Java 13 in CentOS 8 and make the most of web services.


by (3.5m points)
edited

Related questions

+4 votes
1 answer
asked Nov 2, 2019 in Linux / Unix by backtothefuture (552k points) | 715 views
+3 votes
1 answer
+4 votes
1 answer
asked Oct 8, 2020 in Linux / Unix by backtothefuture (552k points) | 360 views
+5 votes
1 answer
asked Sep 2, 2020 in Linux / Unix by backtothefuture (552k points) | 2k views
+3 votes
1 answer
asked Aug 13, 2020 in Linux / Unix by backtothefuture (552k points) | 1.9k views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users