Index: /main/trunk/gli/src/org/greenstone/gatherer/GathererApplet.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/GathererApplet.java	(revision 32152)
+++ /main/trunk/gli/src/org/greenstone/gatherer/GathererApplet.java	(revision 32153)
@@ -152,4 +152,10 @@
 	}
 	
+	// For WebGatherer.java, which uses Java Web Start over JNLP to run the repurposed "applet" as application,
+	// it turned out that for GS3, we need the collectionDirectoryPath set for the subsequent code to work.
+	// In WebGatherer.java, moved the instantiation of the Gatherer object here, but to avoid major changes to
+	// this GathererApplet.java class, just calling the relevant line in Gatherer() constructor at this stage:
+	Gatherer.setCollectDirectoryPath(Gatherer.getGLIUserDirectoryPath() + "collect" + File.separator);
+	
 	File collect_directory = new File(Gatherer.getCollectDirectoryPath());
 	if (!collect_directory.exists()) {
Index: /main/trunk/gli/src/org/greenstone/gatherer/WebGatherer.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/WebGatherer.java	(revision 32152)
+++ /main/trunk/gli/src/org/greenstone/gatherer/WebGatherer.java	(revision 32153)
@@ -194,4 +194,7 @@
 	}
 	
+	// Create an instance of the Gatherer class, which will parse the args and prepare the rest of the GLI
+	gatherer = new Gatherer(args); // Do this early as it will also call Gatherer.setCollectDirectoryPath(), because we need that to have been set hereafter.
+				
 	File collect_directory = new File(Gatherer.getCollectDirectoryPath());
 	if (!collect_directory.exists()) {
@@ -217,7 +220,4 @@
 	    unzipFromJar("metadata.zip", Gatherer.getGLIDirectoryPath());
 	}
-
-	// Create an instance of the Gatherer class, which will parse the args and prepare the rest of the GLI
-	gatherer = new Gatherer(args);
 
 	gatherer.openGUI();
Index: /main/trunk/gli/src/org/greenstone/gatherer/util/JarTools.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/util/JarTools.java	(revision 32152)
+++ /main/trunk/gli/src/org/greenstone/gatherer/util/JarTools.java	(revision 32153)
@@ -133,7 +133,11 @@
     static public boolean isInJar(String filename) 
     {
+	InputStream fis = null;
 	try {
-	    InputStream fis = root_class.getResourceAsStream("/" + filename);		    
-	    fis.close();
+	    fis = root_class.getResourceAsStream("/" + filename);
+		if(fis == null) {
+			System.err.println("@@@ JarTools.isInJar(): file inputstream for file /"+filename+" is still null. Not in jar file.");
+			return false;
+		}
 	}
 	catch (Exception exception) {
@@ -141,4 +145,10 @@
 	    return false;
 	}
+	finally {
+		if(!SafeProcess.closeResource(fis)) {
+			System.err.println("@@@ JarTools.isInJar(): Couldn't close file inputstream");
+			return false;
+		}
+	}
 
 	return true;
Index: /main/trunk/greenstone3/build.xml
===================================================================
--- /main/trunk/greenstone3/build.xml	(revision 32152)
+++ /main/trunk/greenstone3/build.xml	(revision 32153)
@@ -649,13 +649,27 @@
   </path>
 
-
-  <path id="local.tomcat.path">
-    <pathelement location="${basedir}/bin/script"/>
-    <pathelement location="${basedir}/bin"/>
-    <pathelement location="${lib.jni}"/>
-    <pathelement path="${env.PATH}"/>
-    <pathelement path="${env.Path}"/>
-    <pathelement path="${wn.home}/bin"/>
-  </path>
+  
+	<if><bool><isset property="env.PATH"/></bool>
+	  <path id="local.tomcat.path">
+		<pathelement location="${basedir}/bin/script"/>
+		<pathelement location="${basedir}/bin"/>
+		<pathelement location="${lib.jni}"/>	
+		<pathelement path="${env.PATH}"/>
+		<pathelement path="${wn.home}/bin"/>
+	  </path>
+	  <!-- Windows can be case sensitive about env.PATH, preferring env.Path. See https://ant.apache.org/manual/Tasks/property.html  -->
+	  <else><if><bool><isset property="env.Path"/></bool>
+		<path id="local.tomcat.path">
+		  <pathelement location="${basedir}/bin/script"/>
+		  <pathelement location="${basedir}/bin"/>
+		  <pathelement location="${lib.jni}"/>
+		  <pathelement path="${env.Path}"/>
+		  <pathelement path="${wn.home}/bin"/>
+		</path>
+	  <!-- else print error about no path set -->
+	  <else>
+		<echo>No env.PATH (or env.Path) set. Unable to set local.tomcat.path property</echo>
+	  </else></if></else>	
+	</if>	
 
   <target name="test-setup">
@@ -666,4 +680,6 @@
     <echo>is windows : ${current.os.iswindows}</echo>
     <echo>os.unix: ${os.unix}</echo>
+	<echo>env.PATH: ${env.PATH}</echo>
+	<echo>env.Path: ${env.Path}</echo>	
   </target>
 
