Index: /branches/eam_branches/ipp-20121219/ippToPsps/jython/ippjython.sh
===================================================================
--- /branches/eam_branches/ipp-20121219/ippToPsps/jython/ippjython.sh	(revision 34960)
+++ /branches/eam_branches/ipp-20121219/ippToPsps/jython/ippjython.sh	(revision 34961)
@@ -1,10 +1,45 @@
 #!/bin/csh -f 
 
-# XXX EAM 2012.06.29 : this needs to be cleaned up: java should point at an installation directory configured by the build system on installation
+# set JAVA = ~ipp/jre1.7.0_03/bin/java
+# set JYTHON = ~ipp/jython2.5.3b1/jython.jar
 
-set JAVA = ~ipp/jre1.7.0_03/bin/java
-set JYTHON = ~ipp/jython2.5.3b1/jython.jar
+# a bit crude : get the datadir path by interpollation of the PATH element for psconfig
+foreach f ( `echo $PATH | tr : ' '` )
+  echo $f | grep $PSCONFDIR > /dev/null
+  if ($status) continue
+  set datadir = `echo $f | sed s/bin\$/share/`
+  break
+end
 
-set CLASSPATH = ../jars:../jars/stilts.jar:../jars/commonst-math-2-2.jar:../jars/mysql-connector-java-5.1.14-bin.jar
+set JARDIR = $datadir/jar
+set JYDIR = $datadir/jython
 
-$JAVA -Xbootclasspath/a:$CLASSPATH -jar $JYTHON $*
+# XXX install jython in JARDIR
+# set JYTHON = $JARDIR/jython2.5.3b1/jython.jar
+set JYTHON = ~/jython2.5.3b1/jython.jar
+
+if (! -r $JYTHON) then
+  echo "jython jar file not found, check jython installation"
+  exit 2
+endif
+
+if ($?JAVA == 0) then
+  which java >& /dev/null
+  if ($status) then
+    echo "java not found, please specify location in environment or install in path"
+    exit 2
+  endif
+  set JAVA = `which java`
+endif
+
+set CLASSPATH = $JARDIR/stilts.jar\:$JARDIR/commonst-math-2-2.jar\:$JARDIR/mysql-connector-java-5.1.14-bin.jar\:$JYDIR
+
+if ($#argv < 1) then
+  echo "USAGE ippjython.sh (classfile) [options]"
+  exit 2
+endif
+
+set classfile = $1
+shift
+
+$JAVA -Xbootclasspath/a:$CLASSPATH -jar $JYTHON $JYDIR/$classfile $*
