I am using Fedora 20. I installed the rpm from Oracle for the Oracle JDK. How to set up the environment so that the Java environment is Oracle JDK instead of the OpenJDK?
The Oracle JDK is install to /usr/java/ directory. On my Fedora 20, it looks like this:
$ ls /usr/java -l total 4 lrwxrwxrwx. 1 root root 16 Oct 7 2013 default -> /usr/java/latest drwxr-xr-x 8 root root 4096 Apr 18 11:21 jdk1.8.0_05 lrwxrwxrwx 1 root root 21 Apr 18 11:21 latest -> /usr/java/jdk1.8.0_05
I put these 3 lines into my
~/.bashrc (I am using bash) to set up the Java environment:
export JAVA_HOME=/usr/java/default/ export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
JAVA_HOME and CLASSPATH are for Java. I use /usr/java/default/ because this way I will not need to update my ~/.bashrc next time the JDK is upgraded. The last line puts the Java binary directory into the PATH so that the default of invoking of Java software such as
javac will be the one from the Oracle JDK.
And this is the java version:
$ 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) $ javac -version javac 1.8.0_05