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  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 7 on Ubuntu 11

sudo apt-get install mercurial
hg clone
cd jdk7
sh -x ./

sudo aptitude install openjdk-6-jdk gcc-4.2 g++-4.2
sudo aptitude install libmotif-dev
sudo apt-get install ant
sudo apt-get install libasound2-dev
sudo apt-get install libfreetype6-dev
sudo apt-get install gawk
sudo apt-get install libxext-dev
sudo apt-get install libxrender-dev
sudo apt-get install libxtst-dev
export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-6-openjdk
Then a 'make ALLOW_DOWNLOADS=true' gets things rolling.  Not sure why this isn't documented anywhere that was easy to find. One can also go to export LANG=C export ALT_BOOTDIR=/home/beaty/jdk1.7.0_04 export ALT_JDK_IMPORT_PATH=/home/beaty/jdk1.7.0_04 export ALT_HOTSPOT_IMPORT_PATH=/home/beaty/jdk1.7.0_04