#!/bin/sh 

ulimit -s 2048 

INSTALL_DIR=/< path to >/Caterpillar/ 

CWD=`pwd` 

# Make the filename absolute if it isn't already, and then normalize
# it, such that a//b, a/./b and a/foo/../b all become a/b.
if [ $# != 0 ]; then
FILENAME=`(echo "$1" | grep "^/" || echo "$CWD/$1") | \
    sed -e "s:/\{1,\}:/:g" \
        -e "s:/\./:/:g" \
        -e "s:/[^/]*/\.\./:/:g"`
fi

cd $INSTALL_DIR 

RP=lib 

CP=$RP/activation.jar
CP=$CP:aspirin-0.6.4.2.jar
CP=$CP:BrowserLauncher2-10.jar
CP=$CP:Classifier4J-0.51.jar
CP=$CP:commons-httpclient-2.0.jar
CP=$CP:commons-logging-1.0.3.jar
CP=$CP:dnsjava-1.6.4.jar
CP=$CP:ekitspell.jar
CP=$CP:hsqldb.jar
CP=$CP:j2ee.jar
CP=$CP:j2h.jar
CP=$CP:jakarta-regexp-1.3.jar
CP=$CP:jaxen-full.jar
CP=$CP:jdom-b10-rc1.jar
CP=$CP:lucene-1.3-final.jar
CP=$CP:mail_1_3.jar
CP=$CP:saxpath.jar
CP=$CP:swixml.jar
CP=$CP:ui.jar
CP=$CP:xmlrpc-1.2-b1.jar

java -cp $CP -Xincgc org.masukomi.caterpillar.core.Caterpillar $FILENAME 
#java -cp $CP $INSTALL_DIRCaterpillar\.jar 

cd $CWD
