Index: /main/trunk/greenstone2/bin/script/build
===================================================================
--- /main/trunk/greenstone2/bin/script/build	(revision 24092)
+++ /main/trunk/greenstone2/bin/script/build	(revision 24093)
@@ -276,5 +276,6 @@
 		#       option was given to build)
 
-		my $download_cmd = "perl -S gsWget.pl -P \"$importdir\" -np -nv";
+		#$^X is a special variable containing the full path to the current perl executable we are in
+		my $download_cmd = "$^X -S gsWget.pl -P \"$importdir\" -np -nv";
 		$download_cmd .= " -r -N -l inf -R \"*\\?*\"";
 		$download_cmd .= " -o \"$outfile.download\"" if $use_out;
@@ -325,5 +326,6 @@
 		if (-e $download_dir) {
 		    # copy download_dir and all it contains to the import directory
-		    my $download_cmd = "perl -S filecopy.pl";
+		    #$^X is a special variable containing the full path to the current perl executable we are in
+		    my $download_cmd = "$^X -S filecopy.pl";
 		    $download_cmd .= " -collectdir \"$collectdir\"" if $collectdir =~ /\w/;
 		    $download_cmd .= " -site \"$site\"" if $site =~ /\w/;
@@ -464,5 +466,6 @@
     print $out "importing the $collection collection\n\n";
 
-    my $import_cmd = "perl -S import.pl";
+    #$^X is a special variable containing the full path to the current perl executable we are in
+    my $import_cmd = "$^X -S import.pl";
     $import_cmd .= " -out \"$outfile.import\"" if $use_out;
     if ($append) {
@@ -510,5 +513,6 @@
     print $out "building the $collection collection\n\n";
 
-    my $build_cmd = "perl -S buildcol.pl";
+    #$^X is a special variable containing the full path to the current perl executable we are in
+    my $build_cmd = "$^X -S buildcol.pl";
 
     my $removeold = 1;
Index: /main/trunk/greenstone2/bin/script/full-buildcol.pl
===================================================================
--- /main/trunk/greenstone2/bin/script/full-buildcol.pl	(revision 24092)
+++ /main/trunk/greenstone2/bin/script/full-buildcol.pl	(revision 24093)
@@ -48,5 +48,6 @@
     }
 } else {
-    $buildcol_cmd = "perl -S $buildcol_cmd";
+    #$^X is a special variable containing the full path to the current perl executable we are in
+    $buildcol_cmd = "$^X -S $buildcol_cmd";
 }
 
Index: /main/trunk/greenstone2/bin/script/full-import.pl
===================================================================
--- /main/trunk/greenstone2/bin/script/full-import.pl	(revision 24092)
+++ /main/trunk/greenstone2/bin/script/full-import.pl	(revision 24093)
@@ -48,5 +48,6 @@
     }
 } else {
-    $import_cmd = "perl -S $import_cmd";
+    #$^X is a special variable containing the full path to the current perl executable we are in
+    $import_cmd = "$^X -S $import_cmd";
 }
 
Index: /main/trunk/greenstone2/bin/script/full-rebuild.pl
===================================================================
--- /main/trunk/greenstone2/bin/script/full-rebuild.pl	(revision 24092)
+++ /main/trunk/greenstone2/bin/script/full-rebuild.pl	(revision 24093)
@@ -112,5 +112,6 @@
 	}
     } else {
-	$launch_cmd = "perl -S ";
+	#$^X is a special variable containing the full path to the current perl executable we are in
+	$launch_cmd = "$^X -S ";
     }
     
Index: /main/trunk/greenstone2/bin/script/gsConvert.pl
===================================================================
--- /main/trunk/greenstone2/bin/script/gsConvert.pl	(revision 24092)
+++ /main/trunk/greenstone2/bin/script/gsConvert.pl	(revision 24093)
@@ -47,4 +47,12 @@
     die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
     unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
+
+    if(!$ENV{'PERLPATH'}) {
+	my $full_perl_exec = $^X;
+	require File::Basename;
+	my $perl_path = File::Basename::dirname($full_perl_exec);
+	$ENV{'PERLPATH'} = $perl_path;
+    }
+
 }
 
@@ -54,5 +62,4 @@
 use util;
 use Cwd;
-use File::Basename;
 
 # Are we running on WinNT or Win2000 (or later)?
@@ -406,5 +413,6 @@
 	# formulate the command
 	my $cmd = "";
-	$cmd .= "perl -S ppttohtml.pl ";
+	$full_perl_path = &util::filename_cat($ENV{'PERLPATH'},"perl");
+	$cmd .= "$full_perl_path -S ppttohtml.pl ";
 	$cmd .= " \"$input_filename\" \"$output_filestem.html\"";
 	$cmd .= " 2>\"$output_filestem.err\""
@@ -439,5 +447,6 @@
 	# formulate the command
 	my $cmd = "";
-	$cmd .= "perl -S xlstohtml.pl ";
+	$full_perl_path = &util::filename_cat($ENV{'PERLPATH'},"perl");
+	$cmd .= "$full_perl_perl -S xlstohtml.pl ";
 	$cmd .= " \"$input_filename\" \"$output_filestem.html\"";
 	$cmd .= " 2>\"$output_filestem.err\""
@@ -977,5 +986,6 @@
     my $cmd = "";
     if ($timeout) {$cmd = "ulimit -t $timeout;";}
-    $cmd .= "perl -S pdftohtml.pl -zoom $pdf_zoom";
+    $full_perl_path = &util::filename_cat($ENV{'PERLPATH'},"perl");
+    $cmd .= "$full_perl_path -S pdftohtml.pl -zoom $pdf_zoom";
     $cmd .= " -c" if ($pdf_complex);
     $cmd .= " -i" if ($pdf_ignore_images);
@@ -1051,5 +1061,6 @@
     if ($timeout) {$cmd = "ulimit -t $timeout;";}
     $output_type =~ s/.*\_(.*)/$1/i;
-    $cmd .= "perl -S pdfpstoimg.pl -convert_to $output_type \"$input_filename\" \"$output_filestem\"";
+    $full_perl_path = &util::filename_cat($ENV{'PERLPATH'},"perl");
+    $cmd .= "$full_perl_perl -S pdfpstoimg.pl -convert_to $output_type \"$input_filename\" \"$output_filestem\"";
     if ($ENV{'GSDLOS'} !~ m/^windows$/i || $is_winnt_2000) {
 	$cmd .= " > \"$output_filestem.out\" 2> \"$output_filestem.err\"";
Index: /main/trunk/greenstone2/bin/script/gti.pl
===================================================================
--- /main/trunk/greenstone2/bin/script/gti.pl	(revision 24092)
+++ /main/trunk/greenstone2/bin/script/gti.pl	(revision 24093)
@@ -31,6 +31,12 @@
     die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
     unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
-}
-
+
+    if(!$ENV{'PERLPATH'}) {
+	my $full_perl_exec = $^X;
+	require File::Basename;
+	my $perl_path = File::Basename::dirname($full_perl_exec);
+	$ENV{'PERLPATH'} = $perl_path;
+    }
+}
 
 use iso639;
@@ -638,5 +644,11 @@
 
     my $target_filepath = &util::filename_cat($gsdl_root_directory, $target_file);
-    my $cmd = "/opt/jdk1.6.0/bin/java -cp $classpath:$classpath/xalan.jar ApplyXSLT $target_language_code $gen_many_html_xsl_filepath $target_filepath | perl -S $split_script_filepath $target_file_directory";
+    my $perl_exec = &util::filename_cat($ENV{'PERLPATH'}, "perl");
+    my $java_exec = "java";
+    if(defined($ENV{'JAVA_HOME'}) && $ENV{'JAVA_HOME'} ne ""){
+	$java_exec = &util::filename_cat($ENV{'JAVA_HOME'}, "bin", "java");
+    }
+
+    my $cmd = "$java_exec -cp $classpath:$classpath/xalan.jar ApplyXSLT $target_language_code $gen_many_html_xsl_filepath $target_filepath | $perl_exec -S $split_script_filepath $target_file_directory";
     my $response = `$cmd`;
     &log_message($cmd);
@@ -644,5 +656,5 @@
     &log_message("Created HTML operational files");
     
-    $cmd = "/opt/jdk1.6.0/bin/java -cp $classpath:$classpath/xalan.jar ApplyXSLT $target_language_code $gen_index_xml_xsl_filepath $target_filepath > " . $target_file_directory . "help_index.xml"; # 2>/dev/null";
+    $cmd = "$java_exec -cp $classpath:$classpath/xalan.jar ApplyXSLT $target_language_code $gen_index_xml_xsl_filepath $target_filepath > " . $target_file_directory . "help_index.xml"; # 2>/dev/null";
     $response = `$cmd`;
     &log_message($cmd);
Index: /main/trunk/greenstone2/bin/script/incremental-buildcol.pl
===================================================================
--- /main/trunk/greenstone2/bin/script/incremental-buildcol.pl	(revision 24092)
+++ /main/trunk/greenstone2/bin/script/incremental-buildcol.pl	(revision 24093)
@@ -111,5 +111,6 @@
 	}
     } else {
-	$buildcol_cmd = "perl -S $buildcol_cmd";
+	#$^X is a special variable containing the full path to the current perl executable we are in
+	$buildcol_cmd = "$^X -S $buildcol_cmd";
     }
 
Index: /main/trunk/greenstone2/bin/script/incremental-import-onlyadd.pl
===================================================================
--- /main/trunk/greenstone2/bin/script/incremental-import-onlyadd.pl	(revision 24092)
+++ /main/trunk/greenstone2/bin/script/incremental-import-onlyadd.pl	(revision 24093)
@@ -118,5 +118,6 @@
 	}
     } else {
-	$import_cmd = "perl -S $import_cmd";
+	#$^X is a special variable containing the full path to the current perl executable we are in
+	$import_cmd = "$^X -S $import_cmd";
     }
 
Index: /main/trunk/greenstone2/bin/script/incremental-import.pl
===================================================================
--- /main/trunk/greenstone2/bin/script/incremental-import.pl	(revision 24092)
+++ /main/trunk/greenstone2/bin/script/incremental-import.pl	(revision 24093)
@@ -138,5 +138,6 @@
 	}
     } else {
-	$import_cmd = "perl -S $import_cmd";
+	#$^X is a special variable containing the full path to the current perl executable we are in
+	$import_cmd = "$^X -S $import_cmd";
     }
 
Index: /main/trunk/greenstone2/bin/script/incremental-rebuild.pl
===================================================================
--- /main/trunk/greenstone2/bin/script/incremental-rebuild.pl	(revision 24092)
+++ /main/trunk/greenstone2/bin/script/incremental-rebuild.pl	(revision 24093)
@@ -93,5 +93,6 @@
 	}
     } else {
-	$launch_cmd = "perl -S ";
+	#$^X is a special variable containing the full path to the current perl executable we are in
+	$launch_cmd = "$^X -S ";
     }
 
Index: /main/trunk/greenstone2/bin/script/mirror.pl
===================================================================
--- /main/trunk/greenstone2/bin/script/mirror.pl	(revision 24092)
+++ /main/trunk/greenstone2/bin/script/mirror.pl	(revision 24093)
@@ -116,5 +116,6 @@
 	# run the mirror program from the import directory
 	my  $cmd = "cd $importdir; ";
-	$cmd .= "perl -S gsw3mir.pl -cfgfile $etcdir/w3mir.cfg";
+	#$^X is a special variable containing the full path to the current perl executable we are in
+	$cmd .= "$^X -S gsw3mir.pl -cfgfile $etcdir/w3mir.cfg";
 	# print "\n$cmd\n";
 	`$cmd`;
@@ -126,5 +127,5 @@
     elsif ((-e "$etcdir/wget.cfg") && (-e "$etcdir/wget.url")) {
 	$ENV{WGETRC} = "$etcdir/wget.cfg";
-	my $cmd = "perl -S gsWget.pl --input-file=$etcdir/wget.url --directory-prefix=$importdir";
+	my $cmd = "$^X -S gsWget.pl --input-file=$etcdir/wget.url --directory-prefix=$importdir";
 	system($cmd);
     }
