Monday, May 9, 2011

Quick source code searching on Linux

While working on a fix in the JDK, I wanted to find all occurrences of a string in large collection of Java source.  I ended up using http://swish-e.org/  Its default file type is *ML, so a simple config file of:
IndexOnly .java
IndexContents TXT* .java
did the trick.  'swish-e -c swish-e.con -i .' and then 'swish-e -w word' -- blazingly fast.

Building OpenJava on Ubuntu 11

Once one has the mercurial repository cloned and the prereqs installed:
sudo aptitude build-dep openjdk-6
sudo aptitude install openjdk-6-jdk gcc-4.2 g++-4.2
sudo aptitude install libmotif-dev
one has to set the following:
export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-6-openjdk 
export ALT_HOTSPOT_CLIENT_PATH=/usr/lib/jvm/java-6-openjdk/jre/lib/i386/client
export ALT_HOTSPOT_SERVER_PATH=/usr/lib/jvm/java-6-openjdk/jre/lib/i386/server
export ALT_HOTSPOT_IMPORT_PATH=/usr/lib/jvm/java-6-openjdk
export ALT_JDK_IMPORT_PATH=/usr/lib/jvm/java-6-openjdk
Well, at least I did.  Then a 'make ALLOW_DOWNLOADS=true' gets things rolloing.  Not sure why this isn't documented anywhere that was easy for me to find.