Stuff Yaron Finds Interesting

Technology, Politics, Food, Finance, etc.

Installing Java in Linux Mandrake 9.1

This article describes how to install Java support in Linux Mandrake 9.1. Step 1 – Get the Java Files –

  1. Go to java.sun.com.
  2. You probably want J2SE so look for something that says that and click on it.
  3. Then look for something that says 'download'.
  4. Then look for the largest non-beta number (it was 1.4.2 when I wrote this).
  5. Then find Linux RPM in self-extracting file. When I wrote this Sun actually put a combined download of NetBeans (their IDE) and Java first. I don't need NetBeans so I skipped to the next section which just downloads the environment. You can either download the JRE or the SDK. The JRE is the 'Java Runtime Environment'. It contains the files needed to run a Java program. The SDK is the 'Software Development Kit'. It contains the JRE plus a bunch more files needed to write your own Java programs. It's probably best to download the SDK just to be safe, after all, diskspace is free and cable modems are really fast..
  6. Click on the link for the SDK.
  7. This will bring you to the license page. Scroll down and click 'accept' in order to sign away your soul.
  8. Click on the file and download it to your favorite tmp directory.

Step 2 – Install Java Files –

  1. Open a shell and login as root
  2. You need to run sh on the bin file you downloaded in order to expand it. If you are downloading SDK version 1.4.2 then the command would be: sh j2sdk-1_4_2_01-linux-i586-rpm.bin
  3. This will bring up another long license screen. Press the space bar a couple of hundred times and you will eventually get to a question along the lines of "Do you agree to the above license terms" to which you type in 'yes' (you already gave up your soul in step 1, so there isn't much to lose). This will cause the script you executed to decompress a .rpm file.
  4. To install the RPM file type in "urpmi X" where X is the rpm filename. In the case of 1.4.2 this was "urpmi j2sdk-1_4_2_01-linux-i586.rpm". This will cause files in the RPM to be installed, somewhere.

Step 3 – Setting Up Your Java Environment –

  1. As your normal non-root identity use your favorite editor to open ~/.bashrc
  2. Add in the following path declaration "PATH=$PATH:X:" where X is the location of the bin directory. In my machine this is "PATH=$PATH:/usr/java/j2sdk1.4.2_01/jre/bin:".
  3. Add in the following JAVA_HOME declaration (this tells Java programs where to find the files they need) "JAVA_HOME=X", this is the same X as before so on my system it is "JAVA_HOME=/usr/java/j2sdk1.4.2_01/jre/bin"
  4. Then add in two export statements
    • export PATH
    • export JAVA_HOME
  5. Save the file
  6. You are now ready to run Java programs

Step 4 – Setting up Mozilla –
Based on http://plugindoc.mozdev.org/linux.html:

  1. Open a root shell
  2. You need to link the Java plugin file into your Mozilla installation. The command is "ln -s Y/plugin/i386/ns610/libjavaplugin_oji.so Z/plugins/libjavaplugin_oji.so". Where Y is the jre installation directory and Z is the mozilla installation directory. On my machine the command is "ln -s /usr/java/j2sdk1.4.2/jre/plugin/i386/ns610/libjavaplugin_oji.so /usr/lib/mozilla-1.3.1/plugins/libjavaplugin_oji.so"
  3. NOTE: If you are using Mozilla 1.4 or higher you need to get the .so file from the /ns610-gcc32 directory not the /ns610 directory.

20 Responses to Installing Java in Linux Mandrake 9.1

Leave a Reply

Your email address will not be published. Required fields are marked *