Archive for the ‘java’ Category

adjust to matched your jre install:

mkdir -p ~/.mozilla/plugins
cd ~/.mozilla/plugins
ln -s /usr/java
ln -s /usr/java/jre1.6.0_18/lib/amd64/libnpjp2.so

and then restart firefox.

G’Day,
I run my own template engine using JSP’s. After I added some dynamic templates (I generate the JSP’s with a JSP :) ) the number of JSP’s exploded and tomcat started to run slowly. So easy fix was just to allocate some more memory. I edited startup.sh:

exec "$PRGDIR"/"$EXECUTABLE" start "$@" -Xmx4096m

but the proper fix will be to unload the servlet after they are used (since they are only used once).

Also note, I’m running 64bit, so I can say 4096m :) It’s nice when 64bit actually helps rather than causes you pain.

Interestingly enough, the problem can be traced to tomcat, and someone recently submitted a patch for exactly the behaviour I’m seeing!

And (Since I didn’t apply the patch), but the current last line in my startup.sh is:

exec "$PRGDIR"/"$EXECUTABLE" start "$@" -Xms4000m -Xmx5096m -XX:-UseGCOverheadLimit

okay, so that all didn’t work that great, and so I built apache with the above patch. Works great.

On my 64bit CentOS 5.4 linux install just installing ant and tomcat fails.
It fails when I go to start the tomcat service or just run ant.

I tried many different things to fix the problem, including removing all the jre/jdks/ant/open jdks and sun jdk’s. My original solution was to stop using the rpm’s and just download direct from apache (and in the case of ant, set ANT_HOME and JAVA_HOME in /usr/local/apache-ant-version/bin/ant). A typical error would look like this:

[cameron@mars java]$ /usr/bin/ant
/usr/bin/build-classpath: error: JAVA_LIBDIR must be set
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/launch/Launcher
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.launch.Launcher
 at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
[cameron@mars java]$

I have two systems that I set up basically identically, it worked fine on one (a parallels jvm running centos 5.4 64bit on my macbook pro) and nothing but problems with a native install. In the end the solution was very simple.

edit your /etc/java/java.conf file.

/etc/java/java.conf

# System-wide Java configuration file                                -*- sh -*-
#
# JPackage Project 

# Location of jar files on the system
JAVA_LIBDIR=/usr/share/java

# Location of arch-specific jar files on the system
JNI_LIBDIR=/usr/lib/java

# Root of all JVM installations
JVM_ROOT=/usr/lib/jvm

# You can define a system-wide JVM root here if you're not using the default one
#JAVA_HOME=$JVM_ROOT/java

# Options to pass to the java interpreter
JAVACMD_OPTS=