Install JDK with "rpm" Command

This section provides a tutorial on how to download and install JDK packages from 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

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-", and run the "curl" command to download it:

herong$ curl \
   /java-1.7.0-openjdk-devel- \
   > 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: is needed by \

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

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

Or give up using the 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


 Full Version in PDF/EPUB