Install JDK with "rpm" Command

This section provides a tutorial on how to download and install JDK packages from pkgs.org repository using 'rpm' command on CentOS systems.

Since I already have the JRE 1.7 installed, let me try to download and install the JDK 1.7 developer component manually on my CentOS 6.0 system using the RPM (Red Hat Package Manager) tool.

1. Go to Linux central repository Java "devel" package page at https://pkgs.org/download/java-devel.

2. Open the "CentOS 6 > i386" section.

3. Take the URL of the lowest update of 1.7 package: "java-1.7.0-openjdk-devel-1.7.0.181-2.6.14.10.el6.i686.rpm", and run the "curl" command to download it:

herong$ curl http://mirror.centos.org/centos/6/os/i386/Packages \
   /java-1.7.0-openjdk-devel-1.7.0.181-2.6.14.10.el6.i686.rpm \
   > java-devel-1.7.rpm

4. Try to install it with the "rpm" command:

herong$ rpm -i java-devel-1.7.rpm
 error: Failed dependencies:
 	java-1.7.0-openjdk = 1:1.7.0.181-2.6.14.10.el6 is needed by \
     java-1.7.0-openjdk-devel-1:1.7.0.181-2.6.14.10.el6.i686

So the 1.7 "devel" package (update 181) is not compatible with existing the 1.7 base package (update 161):

herong$ rpm -q java-1.7.0-openjdk
java-1.7.0-openjdk-1.7.0.161-2.6.12.0.el6_9.i686

To fix the issue, I need to download install the base package "java-1.7.0-openjdk-1.7.0.181" first. Then install the "java-1.7.0-openjdk-devel-1.7.0.181" component.

Or give up using the pkgs.org repository and "rpm" tool, and use the "yum" tool as shown in the next tutorial.

Table of Contents

 About This JDK Tutorial Book

JDK (Java Development Kit)

 What Is JDK

 Download and Install JDK on Windows

 Writing My First Java Program

 Adding JDK "bin" Directory to Path Setting

 JDK Documentation Installation

 Download and Install JDK on macOS

 Check JDK Version on CentOS

Install JDK with "rpm" Command

 Install JDK with "yum" Command

 Java Date-Time API

 Date, Time and Calendar Classes

 Date and Time Object and String Conversion

 Number Object and Numeric String Conversion

 Locales, Localization Methods and Resource Bundles

 Calling and Importing Classes Defined in Unnamed Packages

 HashSet, Vector, HashMap and Collection Classes

 Character Set Encoding Classes and Methods

 Character Set Encoding Maps

 Encoding Conversion Programs for Encoded Text Files

 Java Logging

 Socket Network Communication

 Datagram Network Communication

 DOM (Document Object Model) - API for XML Files

 SAX (Simple API for XML)

 DTD (Document Type Definition) - XML Validation

 XSD (XML Schema Definition) - XML Validation

 XSL (Extensible Stylesheet Language)

 Message Digest Algorithm Implementations in JDK

 Private key and Public Key Pair Generation

 PKCS#8/X.509 Private/Public Encoding Standards

 Digital Signature Algorithm and Sample Program

 "keytool" Commands and "keystore" Files

 KeyStore and Certificate Classes

 Secret Key Generation and Management

 Cipher - Encryption and Decryption

 The SSL (Secure Socket Layer) Protocol

 SSL Socket Communication Testing Programs

 SSL Client Authentication

 HTTPS (Hypertext Transfer Protocol Secure)

 Outdated Tutorials

 References

 Full Version in PDF/EPUB