Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Saturday, May 24, 2008

Basics: Lucene and Search

Basics about Lucene ranking -- here

Search Internals by user rainman on wikipedia

This might also be helpful -- a thesis

Saturday, November 10, 2007

Java on Ubuntu

Ubuntu has GCJ installed by default. A different version of Java can be installed using the Synaptic Package Manager. Sun's Java 1.5 and 1.6 are available through the package manager.

The problem is, even after installing Sun's Java, GCJ is the default.

The default version of java can be changed using the update-java-alternatives command.

update-java-alternatives -l will give the list of all installed java packages.
example output:
java-1.5.0-sun 53 /usr/lib/jvm/java-1.5.0-sun
java-gcj 1042 /usr/lib/jvm/java-gcj


update-java-alternatives -s java-1.5.0-sun will set Sun's java as the default.

For some applications like Ant, Tomcat to run, you nee to set the JAVA_HOME environment variable like below
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun

The above export can be put in /etc/bash.bashrc (for all users) or /home/<user>/.bashrc (for a particular user) so that JAVA_HOME is available on logon.

Saturday, April 22, 2006

Getting rid of java.lang.OutOfMemoryError

Most JVMs allocate memory on the heap for almost everything, except for reflective data. That is put in a separate location which is a section of the heap that is reserved for permanent generation. This gets easily filled up when you dynamically load an unload classes, or have a large number of classes. Simply add the following options to the java executable and all worries will be gone:
-XX:PermSize=256M -XX:MaxPermSize=256M
The entire command looks like this:
java -server -Djava.awt.headless=true -Xms1024M -Xmx1024M -XX:PermSize=256M -XX:MaxPermSize=256M
Read This