Java on Linux: How to install and enable Oracle’s Java instead of OpenJDK
Many of the major Linux distributions come bundled with OpenJDK Java instead of the “standard” Sun Java or — since Sun Microsystems acquisition by Oracle in 2010 — Oracle Java. One such distro is Fedora, for example.
Open JDK is ok in most cases but there are situations where you need to install the “real” Java on your computer and/or be able switch between them.
This article : http://www.if-not-true-then-false.com/2014/install-oracle-java-8-on-fedora-centos-rhel – is the best info on the subject I have seen so far.
Key points to remember:
——————————-
1. After installing the new Java package run ‘alternatives’ to make the system recognizes that this is the Java environment from now on:
## 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
2. Check Java and the Java plug-in versions to ensure that they were changed as expected ($ java -version
and about:plugins
).
3. You can use alternatives --config
if you ever want to go back to one of the previous versions:
$ alternatives --config java There are 7 programs which provide 'java'. Selection Command ----------------------------------------------- 1 /usr/java/jre1.8.0_51/bin/java 2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java 3 /usr/java/jre1.8.0_45/bin/java 4 /usr/java/jdk1.8.0_91/jre/bin/java 5 /usr/java/jre1.8.0_91/bin/java *+ 6 /usr/java/latest/bin/java 7 /usr/java/latest/jre/bin/java Enter to keep the current selection[+], or type selection number:
4. Older Java releases can be downloaded from: http://www.oracle.com/technetwork/java/javase/archive-139210.html
-
Categories
- Android Development
- Bash
- C programming
- dpkg/apt-get
- drupal
- Emacs
- Git
- Java
- Linux administration
- Linux device drivers
- Linux Gaming
- Linux kernel
- Linux Networking
- Linux on Windows
- Linux printing
- Linux sound and ALSA
- Package Managers
- Programming
- RPM
- Shell and environment
- Tips and tricks
- Uncategorized
- VirtualBox
- Virtualization
- web development
- wine
- WMaker
- Wordpress Tips
- X Window System
- XFCE
-
Articles
- August 2020
- August 2019
- May 2019
- July 2017
- February 2017
- January 2017
- November 2016
- October 2016
- September 2016
- August 2016
- July 2016
- June 2016
- April 2016
- March 2016
- December 2015
- November 2015
- September 2015
- June 2015
- May 2015
- April 2015
- March 2015
- February 2015
- January 2015
- December 2014
- October 2014
- February 2014
- January 2014
- November 2013
- October 2013
- June 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- October 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- September 2011
- August 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
-
Meta
Cloud
audio bash boot compile C programming cups drupal emacs etc Fedora git grep how to httpd init kernel libc linux linux partition localtime login make mount mp3 mysql networking oracle package managers password phpMyAdmin programming rpm shell sql vbox version control system virtual box vm web server wordpress www xargs xfce xwin yum