[CentOS] java annoyances

Ljubomir Ljubojevic office at plnet.rs
Fri Jul 8 18:58:07 UTC 2011


m.roth at 5-cent.us wrote:
> Fresh install on a brand new box (Dell Precision 3500) of 5.6. I install
> Sun java-1.6.0_26-b03, Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02,
> mixed mode)
> 
> Then
> ln -s
> /usr/lib/jvm/java-1.6.0-sun-1.6.0.26.x86_64/jre/lib/amd64/libnpjp2.so
> /usr/lib64/mozilla/plugins
> 
> about:plugins shows java enabled (oddly enough, I seem to have flash,
> 32-bit, in the 32 bit libs, and that doesn't show; guess I need to install
> nspluginwrapper). I go to the java tester, as recommended on the CentOS
> wiki, <http://javatester.org/version.html>, no pink rectangle, and if I
> click on the enabled link, firefox crashes, with
> firefox --no-remote -P
> Exception in thread "main" java.lang.NoClassDefFoundError:
> sun/plugin2/main/server/MozillaPlugin
> Caused by: java.lang.ClassNotFoundException:
> sun.plugin2.main.server.MozillaPlugin
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
> Segmentation fault
> 
> Anyone got any ideas what's wrong? Clues for the poor?
> 
This what I use for java in Firefox:

Java na CentOS-u i Firefox (new)

1. yum install java

2. Now you need to add the Java you have installed to the list of 
alternatives for the java executable:
/usr/sbin/alternatives --install /usr/bin/java java 
/usr/java/latest/bin/java 2

Note: Tinker with /usr/java/latest/bin/java if you do not have Java 
installed at this location. In other words change it to point to the 
location of your installed Java executable from Sun.

3. Now configure alternatives to select the latest Java executable under 
/usr/java:
/usr/sbin/alternatives --config java

Check the version of Java to ensure that it is from Sun:
java -version

For example, this is the output I get:

java version "1.6.0_16″
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) 64-Bit Server VM (build 14.2-b01, mixed mode)

Go to /usr/lib64/mozilla/plugins:
cd /usr/lib64/mozilla/plugins
ili
cd /usr/lib/mozilla/plugins

4. Create a symbolic link to libnpjp2.so (Firefox plugin for Java):
ln -s /usr/java/latest/jre/lib/amd64/libnpjp2.so
ili
ln -s /usr/java/latest/jre/lib/i386/libnpjp2.so

Note: The above is applicable for JDK installation. For JRE it is likely 
to be:
ln -s /usr/java/latest/lib/amd64/libnpjp2.so
ili
ln -s /usr/java/latest/lib/i386/libnpjp2.so
5. Restart Firefox and type the following in URL field and press Enter:
about:plugins

You should now see a section titled Java(TM) Plug-in 1.6.x

You are done installing Java Plugin / Applet support in Firefox on CentOS 5.

ln -s /usr/java/latest/plugin/i386/ns7/libjavaplugin_oji.so  u 
/usr/lib/mozilla/plugins


please watch out for i386/x86_64 differences, and replace path where needed.


Ljubomir



More information about the CentOS mailing list