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/

and then restart firefox.

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

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 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:
 at Method)
 at java.lang.ClassLoader.loadClass(
 at sun.misc.Launcher$AppClassLoader.loadClass(
 at java.lang.ClassLoader.loadClass(
 at java.lang.ClassLoader.loadClassInternal(
[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.


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

# Location of jar files on the system

# Location of arch-specific jar files on the system

# Root of all JVM installations

# You can define a system-wide JVM root here if you're not using the default one

# Options to pass to the java interpreter