Seems to work fine. I am writing it down here, because I do not do it often, and I keep forgetting the steps.
Installing java
I have switched over to using openjdk. It seems to be pretty stable and standard in Fedora Core.
The openjdk-7-jre package contains just the Java Runtime Environment
yum install java-1.7.0-openjdk
The actual Java Development Kit can be installed as below.
yum install java-1.8.0-openjdk-devel
Call me weird, but I find it confusing to name both packages "openjdk", but then, that's the name of the thing.
Switching javac
If I try "
alternatives --config javac", I get.
There are 2 programs which provide 'javac'.
Selection Command
-----------------------------------------------
* 1 /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75-2.5.4.2.fc20.x86_64/bin/javac
+ 2 /usr/lib/jvm/java-1.8.0-openjdk.x86_64/bin/javac
Enter to keep the current selection[+], or type selection number:
Switching java
If I try "
alternatives --config java", I get.
There is 1 program that provides 'java'.
Selection Command
-----------------------------------------------
*+ 1 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
Enter to keep the current selection[+], or type selection number:
I need to install the Oracle JDK, that is as simple as downloading the rpm and installing it with "
rpm i jdk-7u13-linux-x64.rpm".
Then, I am required to set a symbolic link using the 'alternatives --install' commandline. See [1] for more information on that.
Then, I can set the default using "alternatives --config java" again.
[root@localhost Downloads]# alternatives --config java
There are 3 programs which provide 'java'.
Selection Command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java
*+ 3 /usr/java/jre1.7.0_45/bin/java
Enter to keep the current selection[+], or type selection number:
Updated 22 April 2014: added OpenJDK, removed specifics regarding Oracle
References
- [1] Installing Sun Oracle Java JDK on Fedora, Centos, Redhat and RHel
- http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-hat-rhel/
- Java - FedoraProject
- http://fedoraproject.org/wiki/Java
- OpenJDK
- http://openjdk.java.net/install/