Personal tools
You are here: Home Fedora Solved Browser Solutions Sun Java Installation

Sun Java Installation

by scott_glaser last modified Aug 08, 2008 02:01 PM
Contributors: Ben Williams
— filed under:

Some people are intimidated by the Jpackage installation process, for those people here is a "down and dirty" intallation without having to rebuild any packages. Steps 1 - 8 cover the basic plugin for Mozilla and Firefox. Steps 9 - 20 cover the requirements for programs that require Java, such as Limewire.

Applicable to Fedora Versions

  • Fedora 8+

Requirements

  • Fedora Core x86 Installation
  • Mozilla x86 Installed or Firefox x86 Installed
  • For F8: Remove java-1.7.0-icedtea and java-1.7.0-icedtea-plugin
  • For F9: Remove java-1.6.0-openjdk and java-1.6.0-openjdk-plugin
  • Install compat-libstdc++-33, These compatability libraries are requried with java 1.6+
  • Install compat-libstdc++-296, These compatibility libraries are requried with java 1.6+
  1. Open a terminal .
  2. Login as root by entering the following.

    su --login 
  3. At the password prompt enter the password for root.
  4. This step is only to be executed if you are running Fedora 8: Remove java-1.7.0-icedtea and java-1.7.0-icedtea-plugin.
     yum remove java-1.7.0-icedtea java-1.7.0-icedtea-plugin
  5. This step is only to be executed if you are running Fedora 9: Remove java-1.6.0-openjdk and java-1.6.0-openjdk-plugin.
     yum remove  java-1.6.0-openjdk java-1.6.0-openjdk-plugin
  6. Install the compatiablility libraries by performing the following:
    yum install compat-libstdc++-33 compat-libstdc++-296
  7. After the libraries are installed perform the following:
    /sbin/ldconfig
  8. Ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/lib and /usr/lib). The cache is used by the run-time linker, ld.so or ld-linux.so. ldconfig checks the header and filenames of the libraries it encounters when determining which versions should have their linksupdated.  Note that on a successful execution the command will give no output.
  9. Once these steps are completed perform the steps listed in the Doing the Work Section

Doing the work

  1. Download the latest version of the JRE bin here. (http://java.sun.com/javase/downloads/index.jsp ).

    (the .bin file NOT the rpm.bin).  At this time the current version is "JRE 6 Update 7".

  2. Select the Download button next to your selection.

  3. Choose "Linux" from the Platform dropdown.  Click on the checkbox to agree to the license agreement, then click on "Continue".

  4. On the Download screen choose the desired .bin (NOT .rpm.bin) file and download it by clicking on the file name.
  5. Open a terminal .
  6. Login as root by entering the following.

    su --login 
  7. Now change to the directory /opt.

    cd /opt
  8. At the password prompt enter the password for root.
  9. Execute the binary installation for JRE in the /opt directory (ensure that you use the path to the downloaded file i.e. /home/user/Downloads).

    sh /home/$youruser/Download/jre-6u7-linux-i586.bin

    After executing this command you will need to read through the License Agreement and type yes for the installer to actually start installing the software. Once installed it will create a folder "jre1.6.0_06" in the /opt directory.

  10. Now to install the plug-in execute the following command.

    ln -s /opt/jre1.6.0_07/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla/plugins/libjavaplugin_oji.so
  11. Create a java.sh script by entering the following, ensure you press enter after each line of text entered.

    cat <<EOF>> /etc/profile.d/java.sh
    export JAVA_HOME=/opt/jre1.6.0_07
    export PATH=\$JAVA_HOME/bin:\$PATH
    EOF
  12. NOTE: This part must be executed as root and using root's PATH. Root's PATH is obtained by using 'su --login' NOT sudo or 'su' on it's own.

    In the terminal (which should still be open) type:

    source /etc/profile.d/java.sh
  13. Hit enter, then type the following.

    /usr/sbin/alternatives --install /usr/bin/java java /opt/jre1.6.0_07/bin/java 2
  14. Hit enter, then type the following.:

    /usr/sbin/alternatives --config java
  15. Hit enter, Then the following text should be displayed.

    There are 2 programs which provide 'java'.

    Selection Command
    -----------------------------------------------
    + 1 /opt/jre1.6.0_07/bin/java
    * 2 /usr/lib/jvm/jre-1.5.0-gcj/bin/java

    Enter to keep the current selection[+], or type selection number:
  16. Enter the number that references the version of java you installed, in this case 1. Type 1 then press enter.

    1  

    Note: or choose the selection for /opt/jre1.6.0_07/bin/java

  17. Hit enter, then type the folllowing.

    /usr/sbin/alternatives --display java
  18. Hit enter, then a line similar to the following should be displayed.

    java - status is manual.
    link currently points to /opt/jre1.6.0_06/bin/java
    /opt/jre1.6.0_07/bin/java - priority 2
    slave keytool: (null)
    slave rmiregistry: (null)
    slave jre_exports: (null)
    slave jre: (null)
    /usr/lib/jvm/jre-1.5.0-gcj/bin/java - priority 1500
    slave keytool: /usr/lib/jvm/jre-1.5.0-gcj/bin/keytool
    slave rmiregistry: /usr/lib/jvm/jre-1.5.0-gcj/bin/rmiregistry
    slave jre_exports: /usr/lib/jvm-exports/jre-1.5.0-gcj
    slave jre: /usr/lib/jvm/jre-1.5.0-gcj
    Current `best' version is /usr/lib/jvm/jre-1.5.0-gcj/bin/java.
  19. Then perform the following:
     sed -i 's/XINERAMA/FAKEEXTN/g' /opt/jre1.6.0_07/lib/i386/xawt/libmawt.so
  20. Close all instances of Firefox and restart for the plug-in to function properly.

  21. You should now be able to install and run Java applications.

Troubleshooting

How to test

Test you pluging HERE! (http://www.java.com/en/download/help/testvm.xml ) If everything went well you should see a grey box with a little dancing java logo and above the logo should be your java information.

Common problems and fixes

If JAVA applications do not run after restarting firefox, you may need to check your /var/log/audit/audit.log. If you see messages similar to the following "type=AVC msg=audit(1144977424.506:73): avc: denied { execmod } for pid=3005 comm="java_vm" name="libdeploy.so" dev=dm-0 ino=3274482 scontext=user_u:system_r:unconfined_t:s0 tcontext=system_u:object_r:lib_t:s0 tclass=file" you may need to fix the SELINUX context by doing the following as root:

chcon -t textrel_shlib_t /opt/jre1.6.0_07/lib/i386/libdeploy.so

Removing An Old Alternative for Java

For example, if you have installed jre1.6.0_06 and want to remove jre 1.6.05, do the following:
alternatives --remove java /opt/jre1.6.06/bin/java

More Information

Disclaimer

We test this stuff on our own machines, really we do. But you may run into problems, if you do, come to #fedora on irc.freenode.net

Added Reading

 
Document Actions
Log in


Forgot your password?
New user?