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 thoughts on “Installing Java in Linux Mandrake 9.1”

  1. Respected Sir I installed j2sdk1.4.2_04*.rpm according to your advise on my Mandrake Linux 9 but when I give the comand java -version the old vesion installed with kaffe is shown and not my new one please give me some tips how can I takle this prob.
    Abdulkhaliq

  2. i followed the instructions carefully but when i tried to open a java applet at http://www.chikka.com... this came out (via the Java Console):

    load: class app.ChikkaApplet.class not found.
    java.lang.ClassNotFoundException: app.ChikkaApplet.class
    at sun.applet.AppletClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadCode(Unknown Source)
    at sun.applet.AppletPanel.createApplet(Unknown Source)
    at sun.plugin.AppletViewer.createApplet(Unknown Source)
    at sun.applet.AppletPanel.runLoader(Unknown Source)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed.
    at sun.applet.AppletClassLoader.getBytes(Unknown Source)
    at sun.applet.AppletClassLoader.access$100(Unknown Source)
    at sun.applet.AppletClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    … 10 more
    load: class app.ChikkaApplet.class not found.
    java.lang.ClassNotFoundException: app.ChikkaApplet.class
    at sun.applet.AppletClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.applet.AppletClassLoader.loadCode(Unknown Source)
    at sun.applet.AppletPanel.createApplet(Unknown Source)
    at sun.plugin.AppletViewer.createApplet(Unknown Source)
    at sun.applet.AppletPanel.runLoader(Unknown Source)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: open HTTP connection failed.
    at sun.applet.AppletClassLoader.getBytes(Unknown Source)
    at sun.applet.AppletClassLoader.access$100(Unknown Source)
    at sun.applet.AppletClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    … 10 more

    care to help?!

  3. Abdul, I suspect the issue is your path environment variable. If you type “whereis java” on the command line I suspect you will get multiple results, one for the j2sdk1.4.* and one for the kaffe version. If that is the case then the most likely cause of your problem is that the kaffe version of Java is ahead of the j2sdk 1.4.2 version you installed in the path environment variable so when you type 'java -version' you get the kaffe version. Probably the easiest way to deal with this problem assuming 1) you set up your path environment the way I described in the article and 2) You don't need the kaffe version anymore is to just rename Kaffe's Java file to something else like java.kaffee. That way when you type 'Java' the system will always go to the new Java installation.

  4. The errors are actually good news, it means you successfully installed Java. Looking at the error log it looks like your browser isn't able to connect to the server to retrieve the necessary Java files. Alas the number of possible causes for that problem are too numerous to count. A weak response is – try another browser and see what happens?

  5. the installation of java version was successful but when I tried to open the javalite this comes out.”load: class app.ChikkaApplet.class not found” How could I get that?

  6. It means exactly what it says, that the applet can't be found. Your problem sounds the same as David's which is taht the applet in question isn't loading properly. This is, I suspect, a problem with the website providing the applet.

  7. Hi,
    I am in a process of installing java and when I download “J2SE v 1.4.2_07 SDK with NetBeans 4.0 Bundle” from Sun website, and I get “J2SE-*-linux-i586-rpm.bin.part”. Where is extension part coming from? Any ideas ? Did the file use to have JDK……. instead of J2SE……..? Or what am I doing wrong?

    Thanks

    rf

  8. Re: gode

    the *.part extension simply means that the file is not completely downloaded, hence only part of the file. I noticed the same thing (running Mozilla web browser on Mandrake 10.1) and if you re-click the download link it should finish downloading. Give it some time though

  9. can anyone help me?!
    same situation that the chikka javalite failed loading java applet, what should i do, i had just downloaded and installed the java plugins, but still no effect. pls help. thanks!

  10. I got to the point where I need to run the ~/.bashrc thing and now Im lost, I tryed using emacs, but cant figure it out, anyhelp is appreciated…

  11. Shane, unfortunately your description of your problem is a little too brief. What do you mean by lost? Lost as in you don't know how to use emacs? Lost as in you can't find the directory with the binary?

  12. I’ve found useful adding one more system variable: ‘CLASSPATH’, so I’ve followed these instructions. I’ve used information from ‘Thinking in Java, SE’ also. Firstly adding the variable was necessary. I initialized it with a value corresponding to my environment. It was: ‘CLASSPATH=./:/home/khaz/Java/include:’. Then I needed to export it: ‘export CLASSPATH’. These were the changes in .bashrc. After I logged out and in again everything worked just fine. Thanks for help

  13. must we have to learn programming just to use an operating system!?!?
    I don’t know about the rest of these yahoos here, but all of this seems overwhelming. Why can’t there be a simpler way to merely install java.
    Nah, then Billy G wouldn’t get the message.
    Nevermind.

  14. This page is the most helpful I have seem to get my java plugins working. I have done everything you suggest but whereis java is only pointing at
    java: /opt/jdk1.5.0/bin/java
    but I want it to point to my jre1.5.0_06 plugin
    whassup

  15. I have a problem,
    I have an applet on a server that loads and work perfectlly on windows, but on linux (firefox 1.4) it does not work. Java is installed and working fine, the appletviewer succeeds to load and run the applet, but the webbrowser always fails to load it from the server, it gives IO exception: “opening http connection failed, Classfile not found” But if i copied the class files, and html file to be locally on the machine, it loads inside the webbrowser So the plugin is working fine,

    The problem is the rejection when trying to get the file by http connection.!!

    any Ideas??? For me it seems a security issue to enable http requests for the classloader, But it took me too much time without a solution!!!

Leave a Reply

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