Fedora - Blogger - Code Programming - Database - Design

Guide: Install Java JDK/JRE 8u5 on Fedora

Install Java JDK/JRE 8u5 on Fedora

This is guide, howto Install Oracle (Sun) Java JDK and JRE 8 update 5 (8u5) on Fedora 20/19/18/17/16/15/14/13/12, CentOS 6.5/6.4/6.3/6.2/6.1/6/5.10, Red Hat (RHEL) 6.5/6.4/6.3/6.2/6.1/6/5.10.

1. What’s new in Oracle Java 8 


  • Java Programming Language
    • Lambda Expressions, a new language feature
    • Default methods enable new functionality to be added to the interfaces of libraries and ensure binary compatibility with code written for older versions of those interfaces
    • Improved type inference.
  • Collections
    • Classes in the new java.util.stream package provide a Stream API to support functional-style operations on streams of elements
    • Performance Improvement for HashMaps with Key Collisions
  • Security
    • Client-side TLS 1.2 enabled by default
    • Stronger algorithms for password-based encryption
    • SSL/TLS Server Name Indication (SNI) Extension support in JSSE Server
    • SHA-224 Message Digests
    • Enhanced Support for NSA Suite B Cryptography
  • Tools
    • The jjs command is provided to invoke the Nashorn engine
    • The java command launches JavaFX applications
    • The java man page has been reworked
    • The jdeps command-line tool is provided for analyzing class files
    • Java Management Extensions (JMX) provide remote access to diagnostic commands
    • The jarsigner tool has an option for requesting a signed time stamp from a Time Stamping Authority (TSA)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

2. Download Sun/Oracle Java JDK/JRE 8u5 32-bit/64-bit RPM package: Download JDK/JRE 8u5

Select rpm package (jdk-8u5-linux-i586.rpm, jdk-8u5-linux-x64.rpm, jre-8u5-linux-i586.rpm or jre-8u5-linux-x64.rpm)


3. Change root user

sudo -i
## OR ##
su -

4. Install Java JDK or JRE package

## JDK 32-bit ##
rpm -Uvh /path/to/binary/jdk-8u5-linux-i586.rpm
 
## JDK 64-bit ##
rpm -Uvh /path/to/binary/jdk-8u5-linux-x64.rpm
 
## JRE 32-bit ##
rpm -Uvh /path/to/binary/jre-8u5-linux-i586.rpm
 
## JRE 64-bit ##
rpm -Uvh /path/to/binary/jre-8u5-linux-x64.rpm

5a. Install Sun/Oracle JDK javajavawslibjavaplugin.so (for Firefox/Mozilla) and javac withalternatives –install command

Use Java JDK latest version (/usr/java/latest)

## java ##
alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 200000
## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 200000
 
## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/jre/lib/i386/libnpjp2.so 200000
 
## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/jre/lib/amd64/libnpjp2.so 200000
 
## Install javac only if you installed JDK (Java Development Kit) package ##
alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 200000
alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 200000

Use Java JDK absolute version (/usr/java/jdk1.8.0_05)

## java ##
alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_05/jre/bin/java 200000
## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.8.0_05/jre/bin/javaws 200000
 
## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jdk1.8.0_05/jre/lib/i386/libnpjp2.so 200000
 
## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jdk1.8.0_05/jre/lib/amd64/libnpjp2.so 200000
 
## Install javac only if you installed JDK (Java Development Kit) package ##
alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_05/bin/javac 200000
alternatives --install /usr/bin/jar jar /usr/java/jdk1.8.0_05/bin/jar 200000

5b. Install Sun/Oracle JRE javajavaws and libjavaplugin.so (for Firefox/Mozilla) with alternatives –install command

Use Java JRE latest version (/usr/java/latest)

## java ##
alternatives --install /usr/bin/java java /usr/java/latest/bin/java 200000
 
## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/latest/bin/javaws 200000
 
## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/lib/i386/libnpjp2.so 200000
 
## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/lib/amd64/libnpjp2.so 200000

Use Java JRE absolute version (/usr/java/jre1.8.0_05)

## java ##
alternatives --install /usr/bin/java java /usr/java/jre1.8.0_05/bin/java 200000
 
## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/jre1.8.0_05/bin/javaws 200000
 
## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jre1.8.0_05/lib/i386/libnpjp2.so 200000
 
## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jre1.8.0_05/lib/amd64/libnpjp2.so 200000

6. Check current java, javac, javaws and libjavaplugin.so versions

java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
 
javaws
Java(TM) Web Start 11.5.2.13-fcs
[...]
 
javac -version
javac 1.8.0_05
Note: Check libjavaplugin.so with restarting Mozilla Firefox and writing about:plugins on address bar. 
Java 8 Plugin Firefox
Java 8 console output on Fedora 21:
Java 8 Console Output On Fedora

7. Swap between OpenJDK and Sun/Oracle Java JDK/JRE 6, 7 and 8 versions

java

alternatives --config java
 
There are 4 programs which provide 'java'.
 
  Selection    Command
-----------------------------------------------
   1           /usr/java/jdk1.6.0_26/jre/bin/java
   2           /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
   3           /usr/java/jdk1.7.0_55/jre/bin/java
*+ 4           /usr/java/jdk1.8.0_05/jre/bin/java
 
Enter to keep the current selection[+], or type selection number: 4
Note: java with [+] is currently on use

javaws

alternatives --config javaws
 
There are 4 programs which provide 'javaws'.
 
  Selection    Command
-----------------------------------------------
*  1           /usr/java/jdk1.6.0_24/jre/bin/javaws
 + 2           /usr/java/jdk1.6.0_26/jre/bin/javaws
   3           /usr/java/jdk1.7.0_55/jre/bin/javaws
   4           /usr/java/jdk1.8.0_05/jre/bin/javaws
 
Enter to keep the current selection[+], or type selection number: 4
Note: java with [+] is currently on use

libjavaplugin.so (32-bit)

alternatives --config libjavaplugin.so
 
There are 4 programs which provide 'libjavaplugin.so'.
 
  Selection    Command
-----------------------------------------------
*  1           /usr/java/jdk1.6.0_24/jre/lib/i386/libnpjp2.so
 + 2           /usr/java/jdk1.6.0_26/jre/lib/i386/libnpjp2.so
   3           /usr/java/jdk1.7.0_55/jre/lib/i386/libnpjp2.so
   4           /usr/java/jdk1.8.0_05/jre/lib/i386/libnpjp2.so
 
Enter to keep the current selection[+], or type selection number: 4

libjavaplugin.so.x86_64 (64-bit)

alternatives --config libjavaplugin.so.x86_64
 
There are 4 programs which provide 'libjavaplugin.so.x86_64'.
 
  Selection    Command
-----------------------------------------------
*  1           /usr/java/jdk1.6.0_24/jre/lib/amd64/libnpjp2.so
 + 2           /usr/java/jdk1.6.0_26/jre/lib/amd64/libnpjp2.so
   3           /usr/java/jdk1.7.0_55/jre/lib/amd64/libnpjp2.so
   4           /usr/java/jdk1.8.0_05/jre/lib/amd64/libnpjp2.so
 
Enter to keep the current selection[+], or type selection number: 4

javac

alternatives --config javac
 
There are 4 programs which provide 'javac'.
 
  Selection    Command
-----------------------------------------------
*  1           /usr/java/jdk1.6.0_24/bin/javac
 + 2           /usr/java/jdk1.6.0_26/bin/javac
   3           /usr/java/jdk1.7.0_55/bin/javac
   4           /usr/java/jdk1.8.0_05/bin/javac
 
Enter to keep the current selection[+], or type selection number: 4
Note: java with [+] is currently on use

Post-Installation Setup

Add JAVA_HOME environment variable to /etc/profile file or $HOME/.bash_profile file
Java JDK and JRE latest version (/usr/java/latest)
## export JAVA_HOME JDK/JRE ##
export JAVA_HOME="/usr/java/latest"
Java JDK and JRE absolute version (/usr/java/jdk1.8.0_05)
## export JAVA_HOME JDK ##
export JAVA_HOME="/usr/java/jdk1.8.0_05"
 
## export JAVA_HOME JRE ##
export JAVA_HOME="/usr/java/jre1.8.0_05"