Install Oracle Java JDK Version 8u11 on Fedora

I have tested this method on Fedora 20. It may be similar for the following Linux versions as well

  • Fedora 16 and above
  • CentOS 6 and above
  • Red Hat (RHEL) 6 and above

By default, Openjdk java is provided with the OS. But sometimes, people want to use the Oracle/Sun version.

Difference between Openjdk java and Oracle java

Technical differences are a consequence of the goal of each one (OpenJDK is meant to be the reference implementation, open to the community, while Oracle is meant to be a commercial one)

They both have “almost” the same code of the classes in the Java API; but the code for the virtual machine itself is actually different, and when it comes to libraries, OpenJDK tends to use open libraries while Oracle tends to use closed ones; for instance, the font library.

It is generally preferred to use Oracle Java if you are wishing to develop android apps as some of the features may not work with openjdk java. For general programming openjdk is preferred.

Download the latest rpm file

Method 1

Download Sun/Oracle Java from here
http://www.oracle.com/technetwork/java/javase/downloads/index.html

Select rpm package as follows

  • JDK 32 bit jdk-8u11-linux-i586.rpm
  • JDK 64 bit jdk-8u11-linux-x64.rpm

Method 2

Just type the following in the terminal

## JDK 32-bit ##
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u11-b12/jdk-8u11-linux-i586.rpm"


## JDK 64-bit ##
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u11-b12/jdk-8u11-linux-x64.rpm"

Login as root

Type the following in the terminal

su -

Install Java JDK or JRE package

Double click install the rpm package or just type the following to install the downloaded package.

## JDK 32-bit ##
rpm -Uvh /path/to/binary/jdk-8u11-linux-i586.rpm

## JDK 64-bit ##
rpm -Uvh /path/to/binary/jdk-8u11-linux-x64.rpm

Install browser plugins and javac

Method 1 – Use Java JDK latest version (/usr/java/latest)

Type the following into the terminal

## 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

## javac ##
alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 200000

## jar ##
alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 200000

Method 2 – Use Java JDK absolute version (/usr/java/jdk1.8.0_11)

Type the following in the terminal

## java ##
alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_11/jre/bin/java 200000

## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.8.0_11/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_11/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_11/jre/lib/amd64/libnpjp2.so 200000

## javac ##
alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_11/bin/javac 200000

## jar ##
alternatives --install /usr/bin/jar jar /usr/java/jdk1.8.0_11/bin/jar 200000

Set environmental variable

Setup JAVA_HOME and PATH environment variable, i.e, adding JAVA_HOME environment variable to /etc/profile file or $HOME/.bash_profile file and setting PATH.

Method 1 – Java JDK latest version (/usr/java/latest)

export JAVA_HOME="/usr/java/latest"
export PATH=$PATH:/usr/java/latest/bin:/usr/java/latest/jre/bin

Method 2 – Java JDK absolute version (/usr/java/jdk1.8.0_05)

export JAVA_HOME="/usr/java/jdk1.8.0_11"
export PATH=$PATH:/usr/java/jdk1.8.0_11/bin:/usr/java/jdk1.8.0_11/jre/bin

Checking whether installation is successful

Check java, javaws and javac

checking java

Check mozilla firefox java plugin

Test the plugin out at: www.java.com/en/download/help/testvm.xml
A browser restart is not always required.

You can alse check libjavaplugin.so by restarting Mozilla Firefox and writing about:plugins on address bar.

firefox plugin
I hope this works out for everyone. Comment for any queries and I will reply asap.

Top things to do after installing Fedora 20/19/18/17

Fedora misses some very important features like mp3 codecs, pdf reader etc which should have been provided with the installation iso. Here is the guide to set up all of the requirements after installing a fresh copy of Fedora.

First of all update the system using “sudo yum update” command.

Enable RPM Fusion Repositories (VERY IMPORTANT)

Before starting to install any software, we need to enable  RPM FUSION REPOSITORY so that we can install applications like vlc, media-codecs, as well as wifi drivers (for whom these drivers are missing) etc which are not available in Fedora official repositories due to some sort of license issues.
Type the following code in the terminal

su -c 'yum localinstall --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm'

You can also do it graphically by downloading these two files

  • For Fedora 19.
    http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-19.noarch.rpm
    http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-19.noarch.rpm
  • For Fedora 18.
    http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-18.noarch.rpm
    http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-18.noarch.rpm
  • For Fedora 17.
    http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-17.noarch.rpm
    http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-17.noarch.rpm

Do run “sudo yum update” after adding the repo.


Install Fedy (Fedora Utils)

Fedy (earlier known as Fedora Utils) lets you install codecs and additional software, fix problems, tweak and cleanup your system, view system information and much more with just few clicks.

Installing Fedy is as easy as running a single command.

To install the latest version of Fedora Utils in your system, click this line.

Add the Fedy repo to your system to ensure that Fedy up-to-date and all the new features and bug fixes are delivered to you. If you don’t want the repo, you can remove it from the “Help” menu in Fedy.

Fedy saves the downloaded files for so that you can reuse them. It also takes backups before modifying system files for easy recovery. Unlike others, it can perform batch operations too.

Please click here to know more about Fedy.

Install media-codecs and VLC for media playback

Many of the codecs required to play mp3 files, avi files etc are missing from fedora. They must be installed along with a good multimedia player. And when we talk about multimedia player there is no one better than VLC media player.
Type the following code in the terminal

sudo yum install gstreamer gstreamer-ffmpeg gstreamer-plugins-bad gstreamer-plugins-bad-free gstreamer-plugins-bad-nonfree gstreamer-plugins-base gstreamer-plugins-good gstreamer-plugins-ugly ffmpeg
sudo yum install vlc

You can also install the media codecs using Fedy.

Install Gnome-tweak-tool and alternative shutdown menu

Gnome tweak tool is an utility to customize advance Gnome 3 options

Features:

  • Install and switch gnome-shell themes
  • Switch gtk/icon/cursor themes
  • Switch window manager themes
  • Change
    • The user-interface and titlebar fonts
    • Icons in menus and buttons
    • Behavior on laptop lid close
    • Shell font size
    • File manager desktop icons
    • Titlebar click action
    • Shell clock to show date
    • Font hinting and antialiasing

For installing gnome tweak tool type this in terminal

sudo yum install gnome-tweak-tool

You can also install a gnome shell extension called ALTERNATIVE STATUS MENU.

Alternative Status Menu

Alternative Status Menu

By default, alternative status menu no longer displays the Hibernate option. The easiest way to fix this is to install the extension

sudo yum install gnome-shell-extension-alternative-status-menu

Then use gsettings to turn on Hibernate:

gsettings set org.gnome.shell.extensions.alternative-status-menu allow-hibernate true

Then enable the extension in Tweak Tool and restart the shell (alt+f2 and enter r).

Install Google Chrome Browser

METHOD 1
First download and install the key from Google Linux Repository.
Run the following commands in the terminal, issue the password for the user when prompted.

wget https://dl-ssl.google.com/linux/linux_signing_key.pub
sudo rpm --import linux_signing_key.pub

After installing the key run the below command to add it to the repository.

Note: Copy and paste the command as it is below (all the lines at once of a particular architecture at once) .

## Google Repository 32-bit x86 ##
sudo sh -c 'echo "[google-chrome]
name=Google Chrome 32-bit
baseurl=http://dl.google.com/linux/chrome/rpm/stable/i386" >> /etc/yum.repos.d/google-chrome.repo'

## Google Repository 64-bit x86_64 ##
sudo sh -c 'echo "[google-chrome]
name=Google Chrome 64-bit
baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64" >> /etc/yum.repos.d/google-chrome.repo'

Now to install Google Chrome, run the following command:

sudo yum install google-chrome-stable

METHOD 2

You can also install Google Chrome using Fedy.

METHOD 3
Alternatively you can download the rpm version of Google Chrome from here and install it.

Install Adobe Flash Plugin

METHOD 1

You can download the .rpm package from http://get.adobe.com/flashplayer/ and install by double clicking the package.

METHOD 2

Using Adobe’s own YUM repository it is very easy also keep up-to-date with Flash Player Plugin.

  • Install Adobe YUM Repository RPM package
    ## Adobe Repository 32-bit x86 ##
    sudo rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm
    sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
    
    ## Adobe Repository 64-bit x86_64 ##
    sudo rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm
    sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux
  • Install Adobe Flash Player along with its plugins
    sudo yum install flash-plugin

Install other important plugins

nspluginwrapper is a proxy plug-in and viewer for NPAPI browser plug-ins. It allows browsers to run foreign plug-ins built for a different architecture, most commonly to run a 32-bit plug-in in a 64-bit browser.

PulseAudio (or PA for short) is a sound server that provides a number of features on top of the low-level audio interface ALSA on Linux, such as:

  • Networking support (P2P and server mode).
  • Per-application volume controls
  • Better cross-platform support
  • Dynamic latency adjustment, which can be used to save power

libcurl is a free and easy-to-use client-side URL transfer library, supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP. libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, Kerberos), file transfer resume, http proxy tunneling and more!

libcurl might already be installed on your system. If not, install it.

sudo yum install nspluginwrapper alsa-plugins-pulseaudio libcurl

Install Unrar and 7 zip

sudo yum install unrar p7zip p7zip-plugins

Install Java Browser Plugin

OPTION 1 : Install ORACLE JRE/JDK

You can easily install Oracle JRE/JDK using Fedy.
OR
You can click here to see the procedure.

OPTION 2 : Install OPENJDK JRE
Alternatively you can install OpenJDK  Java Runtime Environment by typing the following command:

su -c 'yum install java-*-openjdk java-*-openjdk-plugin'