Java

From Linuxintro

There are three types of Java Software:

  • Java Applications
These are normal applications that happen to be written in Java. An example is sweetHome3D.
  • Java Applets
These are little programs that are executed in your web browser. Your browser must support Java.
  • Java WebStart
This is a technology that lets you start an application over the web. You do not have to install anything (but Java WebStart). This can be found on embedded web servers often.

Java plugin

Installation

Installing the java plugin for web browsers is a pain, so I describe it here. The description is for Firefox 3.

SLES 11 x64

On SLES 11 x64

yast -i java-1_6_0-ibm
  • downgrade java to sr8 as to be seen in the screenshot below:

Snapshot-java.png

  • install the java plugin
  • for every user (in this case root)
    • make sure the Mozilla plugin directory exists:
    • mkdir -p /root/.mozilla/plugins
    • link the plugin from java to mozilla:
    • ln -s /usr/lib64/jvm/java-1_6_0-ibm-1.6.0/jre/lib/amd64/libnpjp2.so /root/.mozilla/plugins/
  • restart your firefox twice
  • test if it works by surfing to about:plugins

Debian

ln -s /opt/j2sdk1.4.2_04/jre/plugin/i386/ns610-gcc32/libjavaplugin_oji.so
 /usr/lib/mozilla-firefox/plugins

generic

  • find out what your jre directory is. In its lib/amd64 path you will find libnpjp2.so
  • find out what your mozilla plugin directory is
  • Link libnpjp2.so to from the one directory to the other like this:
tweedleburg:/usr/java/jdk1.7.0_25/jre/lib/amd64 # ln -s /usr/java/jdk1.7.0_25/jre/lib/amd64/libnpjp2.so /root/.mozilla/plugins/
  • Verify this has worked by surfing to about:plugins

TroubleShooting

java plugin works for root, but not for user

If the java plugin works for root, but not for another user, log in as the user you want it to work for. Then select (FireFox 10) Tools -> Addons -> Plugins and enable the java plugin.

Java WebStart

Java WebStart is a program and contained in the the J2E JRE package. Its executable file is javaws. Here is an example how I downloaded and installed it for SUSE Linux Enterprise Server 11 x64 on 2012-01-20:

  • go to java.sun.com
  • find the Java SE Runtime 7 Downloads
  • download the rpm package for "linux x64". In this example it is "u2" (update 2).
  • install the package by opening a console and entering
cd 
cd Desktop
rpm -ivh jre-7u2-linux-x64.rpm

To test if the installation worked, type

javaws

TroubleShooting

If your Java WebStart works and then stops working, try troubleshooting by adding a new user to your system. If everything works fine with this new user, delete the user-specific configuration directories, e.g. for SLES 11 this is the command

rm -rf ~/.java ~/.mozilla

See also