[HOWTO] Install Sun/Oracle Java JDK 7 in Fedora 15

Sun/Oracle Java JDK 7 may be required to run some applications that are not compatible with OpenJDK which can be installed using package manager in Fedora 15. Here is how to do it. Open the terminal and use the following commands:

For 64-bit

wget "http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-x64.rpm"
su -c 'rpm -i jdk-7-linux-x64.rpm'

For 32-bit

wget "http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-i586.rpm"
su -c 'rpm -i jdk-7-linux-i586.rpm'

If you already have OpenJDK/OpenJRE installed, you will need to configure your system so that the applications use the Sun/Oracle Java version instead of OpenJDK/OpenJRE. Here is how to do it:

su -c 'alternatives --install /usr/bin/java java /usr/java/jdk1.7.0/jre/bin/java 20000'
su -c 'alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.7.0/jre/bin/javaws 20000'
su -c 'alternatives --install /usr/bin/javac javac /usr/java/jdk1.7.0/bin/javac 20000'
su -c 'alternatives --install /usr/bin/jar jar /usr/java/jdk1.7.0/bin/jar 20000'

For 64-bit:

su -c 'alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jdk1.7.0/jre/lib/amd64/libnpjp2.so 20000'

For 32-bit:

su -c 'alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jdk1.7.0/jre/lib/i386/libnpjp2.so 20000'

Hope this helps.

If you enjoyed this post, make sure you subscribe to my RSS feed!
  • Richard Lloyd

    It should be noted that the alternatives system expects you to create groups of links, with the –install option specifying the master group name and –slave specifying further links in that group. Also, don’t use the version number of the jdk in the path, that’s what /usr/java/latest is for! You also missed a load of other linked binaries (there’s more than 4) – here’s my command (I’ve used backslashes to make it easier to read):

    –install /usr/bin/java java /usr/java/latest/bin/java 20000
    –slave /usr/bin/javaws javaws /usr/java/latest/bin/javaws
    –slave /usr/bin/javac javac /usr/java/latest/bin/javac
    –slave /usr/bin/keytool keytool /usr/java/latest/bin/keytool
    –slave /usr/bin/orbd orbd /usr/java/latest/bin/orbd
    –slave /usr/bin/pack200 pack200 /usr/java/latest/bin/pack200
    –slave /usr/bin/rmid rmid /usr/java/latest/bin/rmid
    –slave /usr/bin/rmiregistry rmiregistry /usr/java/latest/bin/rmiregistry
    –slave /usr/bin/servertool servertool /usr/java/latest/bin/servertool
    –slave /usr/bin/tnameserv tnameserv /usr/java/latest/bin/tnameserv
    –slave /usr/bin/unpack200 unpack200 /usr/java/latest/bin/unpack200

    You’ll note that didn’t include the Java plugin because that’s dependent on your system’s bitness, but you could add it in as per the original blog post.

  • Zakaria


    I do not know why I get the following error message

    [zakaria@localhost ~]$ su -c ‘alternatives –install /usr/bin/javaws javaws /usr/java/jdk1.7.0/jre/bin/javaws 20000′
    Mot de passe :
    impossible de lire le lien /usr/bin/javaws : Aucun fichier ou dossier de ce type

  • Zakaria

    c’est ok après avoir ressayer une deuxième fois

  • Pingback: [HOWTO] Install java browser plugin in Fedora 15 | The _khAttAm_ blog

  • Tsohr

    thank you! this is it.

  • Pingback: Configurações basicas para se utilizar o Fedora 17 « Mateus Malaquias – Blog