Index: main/trunk/greenstone2/runtime-src/src/recpt/cgiwrapper.cpp
===================================================================
--- main/trunk/greenstone2/runtime-src/src/recpt/cgiwrapper.cpp	(revision 28960)
+++ main/trunk/greenstone2/runtime-src/src/recpt/cgiwrapper.cpp	(revision 28973)
@@ -72,4 +72,8 @@
 #endif
 
+#if defined(GSDL_USE_GTI_ACTION)
+#include "gtiaction.h"
+#endif
+
 #if defined(USE_RSS)
 #include "rssaction.h"
Index: main/trunk/greenstone2/runtime-src/src/recpt/gtiaction.cpp
===================================================================
--- main/trunk/greenstone2/runtime-src/src/recpt/gtiaction.cpp	(revision 28960)
+++ main/trunk/greenstone2/runtime-src/src/recpt/gtiaction.cpp	(revision 28973)
@@ -31,4 +31,5 @@
 #include <expat.h>
 #include <stdio.h>
+#include <cstring>
 #include <sys/utsname.h>
 #include "gtiaction.h"
@@ -36,4 +37,5 @@
 #include "fileutil.h"
 #include "gsdlunicode.h"
+#include "gsdltools.h"
 
 
@@ -85,7 +87,19 @@
   text_t set_gsdlos = "GSDLOS=";
 
+  // path to java executable.
+
+  if(java.empty()) {
+    //java = "$JAVA_HOME/bin/java"; // doesn't work
+    //java = "/research/root/jdk1.6.0_27/bin/java"; // can hardcode it, which may be necessary on nzdl or if default java is no longer version 6
+    java = "java";
+  }
+
 #if defined (__WIN32__)
+  path_separator = ";"; // windows (class)PATH separator
+
   set_gsdlos += "windows";
 #else
+  path_separator = ":"; // linux (class)PATH separator
+
   struct utsname *buf = new struct utsname();
   if (uname(buf) == -1) {
@@ -638,7 +652,21 @@
   text_t gti_arguments = "";
   if (target_chunk_type == "work") {
-    gti_arguments = "get-first-n-chunks-requiring-work " + target_language_code + " " + translation_file_key + " " + "10000" + " | /opt/jdk1.6.0/bin/java -cp /home/nzdl/gti:/home/nzdl/gti/xalan.jar ApplyXSLT /home/nzdl/gti/gti-generate-excel-xml.xsl -";
+
+    //gti_arguments = "get-first-n-chunks-requiring-work " + target_language_code + " " + translation_file_key + " " + "10000" + " | /opt/jdk1.6.0/bin/java -cp /home/nzdl/gti:/home/nzdl/gti/xalan.jar ApplyXSLT /home/nzdl/gti/gti-generate-excel-xml.xsl -";
+
+    //gti_arguments = "get-first-n-chunks-requiring-work " + target_language_code + " " + translation_file_key + " " + "10000" + " | /research/root/jdk1.6.0_27/bin/java -cp /research/ak19/gs2-svn-gti:/research/ak19/gs2-svn-gti/bin/java/ApplyXSLT.jar org.nzdl.gsdl.ApplyXSLT -c -t /research/ak19/gs2-svn-gti/bin/script/gti-generate-excel-xml.xsl";
+
+    // don't need to add toplevel gsdlhome to classpath actually, as the following will work from the commandline:
+    // gti.pl get-all-chunks nl coredm | java -cp /research/ak19/gs2-svn-gti/bin/java/ApplyXSLT.jar org.nzdl.gsdl.ApplyXSLT -t /research/ak19/gs2-svn-gti/bin/script/gti-generate-excel-xml.xsl
+    gti_arguments = "get-first-n-chunks-requiring-work " + target_language_code + " " + translation_file_key + " " + "10000" + " | " + java + " -cp " + gsdlhome + path_separator + gsdlhome + "/bin/java/ApplyXSLT.jar org.nzdl.gsdl.ApplyXSLT -c -t " + gsdlhome + "/bin/script/gti-generate-excel-xml.xsl";
+
   } else {
-    gti_arguments = "get-all-chunks " + target_language_code + " " + translation_file_key + " | /opt/jdk1.6.0/bin/java -cp /home/nzdl/gti:/home/nzdl/gti/xalan.jar ApplyXSLT /home/nzdl/gti/gti-generate-excel-xml.xsl -";
+    //gti_arguments = "get-all-chunks " + target_language_code + " " + translation_file_key + " | /opt/jdk1.6.0/bin/java -cp /home/nzdl/gti:/home/nzdl/gti/xalan.jar ApplyXSLT /home/nzdl/gti/gti-generate-excel-xml.xsl -";
+
+    //gti_arguments = "get-all-chunks " + target_language_code + " " + translation_file_key + " | /research/root/jdk1.6.0_27/bin/java -cp /research/ak19/gs2-svn-gti/bin/java/ApplyXSLT.jar org.nzdl.gsdl.ApplyXSLT -c -t /research/ak19/gs2-svn-gti/bin/script/gti-generate-excel-xml.xsl";
+
+    // don't need to add toplevel gsdlhome to classpath actually, as the following will work from the commandline:
+    // gti.pl get-all-chunks nl coredm | java -cp /research/ak19/gs2-svn-gti/bin/java/ApplyXSLT.jar org.nzdl.gsdl.ApplyXSLT -t /research/ak19/gs2-svn-gti/bin/script/gti-generate-excel-xml.xsl
+    gti_arguments = "get-all-chunks " + target_language_code + " " + translation_file_key + " | " + java +  " -cp " + gsdlhome + path_separator + gsdlhome + "/bin/java/ApplyXSLT.jar org.nzdl.gsdl.ApplyXSLT -c -t " + gsdlhome + "/bin/script/gti-generate-excel-xml.xsl";
   }
   
Index: main/trunk/greenstone2/runtime-src/src/recpt/gtiaction.h
===================================================================
--- main/trunk/greenstone2/runtime-src/src/recpt/gtiaction.h	(revision 28960)
+++ main/trunk/greenstone2/runtime-src/src/recpt/gtiaction.h	(revision 28973)
@@ -68,4 +68,7 @@
   char* set_gsdlos_cstr;
 
+  text_t path_separator;
+  text_t java; // java bin path to preferrably 1.6. Set this here or in init() if the path to java is very specific (such as on nzdl)
+
 public:
   gtiaction ();
