Changeset 28979
- Timestamp:
- 2014-04-16T17:33:23+12:00 (10 years ago)
- Location:
- main/trunk/greenstone2
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/common-src/src/lib/gsdlsitecfg.cpp
r16310 r28979 26 26 #include "fileutil.h" 27 27 #include "gsdlsitecfg.h" 28 #include <stdlib.h> // for get/putenv 29 #include <string.h> // for get/putenv 28 30 29 31 #if defined(GSDL_USE_OBJECTSPACE) … … 126 128 *collection = cfgline[0]; 127 129 } 130 131 if(key == "javahome") { 132 133 // javahome is a special variable that may or may not be set by the user in gsdlsite.cfg. 134 // It specifies a custom java install that the user wants to use. If set, assume this is 135 // meant to override the default JAVA_HOME. Any javahome read in from gsdlsite.cfg 136 // will not be stored into the __site_configuration struct however. Instead, directly 137 // do putenv(javahome), just like gtiaction.cpp uses putenv, after printing out a warning 138 // to StdErr if getenv(JAVA_HOME) shows that JAVA_HOME is already set to something. 139 140 text_t javahome(cfgline[0]); 141 142 // getenv returns NULL if not set, http://www.cplusplus.com/reference/cstdlib/getenv/ 143 // 'The string pointed by the pointer returned by this function shall not be modified by the program.' 144 char* existing_javahome = getenv("JAVA_HOME"); 145 146 if(existing_javahome != NULL) { 147 // cerr goes to: apache-httpd/<OS>/logs/error_log 148 cerr << "Warning: JAVA_HOME is already set to: " << existing_javahome << endl; 149 cerr << "But overwriting with javahome set in gsdlsite.cfg: " << javahome << endl; 150 } 151 152 // http://www.kev.pulo.com.au/pp/RESOURCES/cplusplus/ref/cstdlib/putenv.html 153 // putenv is not defined in ANSI-C, but is supported by many compilers, and is 154 // already used in gtiaction.cpp 155 javahome = "JAVA_HOME=" + javahome; 156 char* set_javahome_cstr = javahome.getcstr(); 157 putenv(set_javahome_cstr); 158 159 // can't use locally declared char array that we string-copy the cstr into, 160 // since the array's value expires from putenv, possibly after this function's local scope 161 // Forced to assign the dynamically allocated cstr and resist the urge to delete this: 162 //delete[] set_javahome_cstr; // may not delete it, else the env var just set will become empty 163 } 128 164 129 165 if (actions != NULL && key == "actions") { -
main/trunk/greenstone2/runtime-src/src/recpt/gtiaction.cpp
r28973 r28979 87 87 text_t set_gsdlos = "GSDLOS="; 88 88 89 // path to java executable. 90 91 if(java.empty()) { 89 // Path to java executable. If javahome property was set in gsdlsite.cfg, 90 // then common-src/src/lib/gsdlsite.cfg would have read this in and set it in the env 91 // If the env var is empty, default to trying to use just "java" 92 char* existing_javahome = getenv("JAVA_HOME"); // return value may not be modified by the program 93 94 if(existing_javahome == NULL) { 92 95 //java = "$JAVA_HOME/bin/java"; // doesn't work 93 //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 94 java = "java"; 95 } 96 java = "java"; // works locally, but not on nzdl. On nzdl need to set javahome in gsdlsite.cfg 97 } else { 98 java = existing_javahome; 99 java += "/bin/java"; 100 } 96 101 97 102 #if defined (__WIN32__) … … 655 660 //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 -"; 656 661 657 //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"; 658 659 // don't need to add toplevel gsdlhome to classpath actually, as the following will work from the commandline: 660 // 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 662 // don't actually need to add toplevel gsdlhome to classpath 661 663 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"; 662 664 … … 664 666 //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 -"; 665 667 666 //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"; 667 668 // don't need to add toplevel gsdlhome to classpath actually, as the following will work from the commandline: 669 // 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 668 // don't actually need to add toplevel gsdlhome to classpath 670 669 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"; 671 670 } 672 671 673 672 text_t gti_response_xml_text = do_gti_request(gti_arguments, logout); 674 673 if (gti_response_xml_text == "") { -
main/trunk/greenstone2/runtime-src/src/recpt/gtiaction.h
r28973 r28979 69 69 70 70 text_t path_separator; 71 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)71 text_t java; // path to java executable 72 72 73 73 public:
Note:
See TracChangeset
for help on using the changeset viewer.