How to install the Java Runtime Environment from Java.com
If a browser plugin and Java runtime are all that is required, as opposed to a full Java development environment, the Oracle (formerly Sun) Java Runtime Environment (JRE) RPMs work for all currently supported CentOS versions, and are arguably the most compatible with web pages that require a Java plugin. The Java versions shown below are current as of this writing. Always use the latest available version for your architecture (i386 32-bit or x86_64/amd64 64-bit) and adjust accordingly.
is now available. It was reported as functional using the same procedure as below.
Java i386 JRE and plugin
Download the latest Linux RPM (self-extracting file), currently jre-6u30-linux-i586-rpm.bin, from then as install and configure the alternatives system and plugins:
# cd [download directory]# sh ./jre-6u30-linux-i586-rpm.bin# alternatives --config javaThere are 2 programs which provide 'java'. Selection Command-----------------------------------------------*+ 1 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java 2 /usr/lib/jvm/jre-1.5.0-gcj/bin/javaEnter to keep the current selection[+], or type selection number:
Note number of versions, N, and use N+1 (if there is no output from the previous command, just imagine that N=0) - For example, if 2 versions were installed then:
# alternatives --install /usr/bin/java java /usr/java/latest/bin/java 3# alternatives --config javaThere are 3 programs which provide 'java'. Selection Command-----------------------------------------------*+ 1 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java 2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java 3 /usr/java/latest/bin/javaEnter to keep the current selection[+], or type selection number: 3# java -versionjava version "1.6.0_30"Java(TM) SE Runtime Environment (build 1.6.0_30)Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)
Create links in the Mozilla Plugins directory so Java will work in supported browsers such as Firefox.
# cd /usr/lib/mozilla/plugins/# ln -fs /usr/java/latest/lib/i386/libnpjp2.so
Skip to the section on testing the browser plugin.
Java x86_64 JRE and plugin
Download the latest Linux RPM (self-extracting file), currently jre-6u30-linux-x64-rpm.bin, from then as install and configure the alternatives system and plugins:
# cd [download directory]# sh ./jre-6u30-linux-x64-rpm.bin# alternatives --config javaThere are 4 programs which provide 'java'. Selection Command----------------------------------------------- 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java 2 /usr/java/jre1.6.0_13/bin/java 3 /usr/java/jre1.6.0_18/bin/java*+ 4 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/javaEnter to keep the current selection[+], or type selection number:
Note number of versions, N, and use N+1 (if there is no output from the previous command, just imagine that N=0) - For example, if 4 versions were installed then:
# alternatives --install /usr/bin/java java /usr/java/latest/bin/java 5# alternatives --config javaThere are 5 programs which provide 'java'. Selection Command----------------------------------------------- 1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java 2 /usr/java/jre1.6.0_13/bin/java 3 /usr/java/jre1.6.0_18/bin/java*+ 4 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java 5 /usr/java/latest/bin/javaEnter to keep the current selection[+], or type selection number: 5# java -versionjava version "1.6.0_26"Java(TM) SE Runtime Environment (build 1.6.0_30)Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
Create links in the Mozilla Plugins directory so Java will work in supported browsers such as Firefox.
# cd /usr/lib64/mozilla/plugins/# ln -fs /usr/java/latest/lib/amd64/libnpjp2.so
Test browser
Exit Firefox if it is running and [re]start Firefox. Type "about:plugins" in the URL field. It should show Java enabled.
at Java.com, at Java.com or at .
Remove old versions
Oracle recommends removing old Java versions as they represent a security risk if left installed. By default, the installation procedure above will not remove old versions so we must do this manually:
# rpm -qa jre\*jre-1.6.0_13-fcs.x86_64jre-1.6.0_18-fcs.x86_64jre-1.6.0_30-fcs.x86_64# rpm -e jre-1.6.0_18-fcs.x86_64 jre-1.6.0_13-fcs.x86_64
- Java is a trademark of the Oracle Corporation.
-
This page created and maintained by . Other Wiki contributors are invited to make corrections, additions, or modifications.