Index: /main/trunk/gli/GLIapplet.jnlp
===================================================================
--- /main/trunk/gli/GLIapplet.jnlp	(revision 32138)
+++ /main/trunk/gli/GLIapplet.jnlp	(revision 32139)
@@ -20,10 +20,4 @@
  */
 -->
-<!--
-/*
- *	https://docs.oracle.com/javase/9/deploy/migrating-java-applets-jnlp.htm#JSDPG-GUID-1F95EBB3-D5CB-434A-B069-2261900738F5
- *	section "Migrating an Existing Java Applet"
- */
--->
 
 <!-- JNLP File for GLI applet -->
@@ -44,9 +38,14 @@
     <jar href="SignedGatherer.jar"/>
   </resources>
-  <!--<application-desc main-class="org.greenstone.gatherer.WebGatherer"/>-->
-  <applet-desc main-class="org.greenstone.gatherer.WebGatherer" name="GLIapplet" height="50" width="380">
+  <application-desc main-class="org.greenstone.gatherer.WebGatherer">
+	<argument>-gwcgi=/greenstone3</argument>
+    <argument>-gsdl3=true</argument>
+  </application-desc>
+  <!--
+  <applet-desc main-class="org.greenstone.gatherer.GathererApplet" name="GLIapplet" height="50" width="380">
 	<param name="gwcgi" value="/greenstone3" />
     <param name="gsdl3" value="true" />
   </applet>
+  -->
   <!-- https://stackoverflow.com/questions/12600076/getting-user-home-folder-from-jws-signed-jar -->
   <security>
Index: /main/trunk/gli/README_WebGLI.txt
===================================================================
--- /main/trunk/gli/README_WebGLI.txt	(revision 32138)
+++ /main/trunk/gli/README_WebGLI.txt	(revision 32139)
@@ -43,4 +43,5 @@
 https://docs.oracle.com/javase/9/whatsnew/toc.htm
 https://docs.oracle.com/javase/9/deploy/migrating-java-applets-jnlp.htm
+	section "Migrating an Existing Java Applet"
 https://docs.oracle.com/javase/9/deploy/self-contained-application-packaging.htm
 http://www.oracle.com/technetwork/java/javase/migratingfromapplets-2872444.pdf
@@ -65,2 +66,5 @@
 https://docs.oracle.com/javase/8/docs/technotes/guides/jar/jar.html#JARManifest
 https://community.oracle.com/thread/1536875?start=0
+
+https://stackoverflow.com/questions/1199211/java-webstart-with-parameters
+https://stackoverflow.com/questions/14116640/how-to-use-jnlp-to-pass-command-line-arguments-to-the-application
Index: /main/trunk/gli/src/org/greenstone/gatherer/WebGatherer.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/WebGatherer.java	(revision 32138)
+++ /main/trunk/gli/src/org/greenstone/gatherer/WebGatherer.java	(revision 32139)
@@ -28,5 +28,4 @@
 package org.greenstone.gatherer;
 
-import java.applet.*;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -35,4 +34,5 @@
 
 import java.io.*;
+//import javax.jnlp.*;
 import javax.swing.*;
 import org.greenstone.gatherer.util.JarTools;
@@ -40,11 +40,10 @@
 import org.greenstone.gatherer.util.Utility;
 
-
-public class WebGatherer extends JApplet implements ActionListener
+import java.util.*;
+
+public class WebGatherer
 {
-    private Gatherer gatherer = null;
-
-
-    protected String fullLibraryURL(String address) 
+
+    protected static String fullLibraryURL(String address) 
     {
 	String full_address = "";
@@ -55,21 +54,64 @@
 	    full_address = address;
         } 
-	else if (address.startsWith("/")) {
+	/*else if (address.startsWith("/")) {
             // there is not protocol and host
-            URL document = getDocumentBase();
+			// JNLP replacement for applet getDocumentBase, https://stackoverflow.com/questions/6371493/java-web-start-getdocumentbase
+			BasicService bs = (BasicService) ServiceManager.lookup("javax.jnlp.BasicService");
+			URL document = bs.getCodeBase();
 	    int port_no = document.getPort();
 
             String port = (port_no>0) ? ":" + port_no : "";
             full_address = "http://" + document.getHost() + port  + address;
-	}
+	}*/
 
 	return full_address;
     }
 
-
-    /* This is the entry point for the GLI applet */
-    public void init()
+	static private String getParameter(String cmd_arg, String flagName) {
+		int start_index = cmd_arg.indexOf(flagName) + flagName.length();
+		cmd_arg = cmd_arg.substring(start_index);
+		return cmd_arg;
+	}
+
+    /* This is the entry point for the Java Web Start version of GLI (a rewrite of GathererApplet as a Java Web Start application) */
+    static public void main(String cmdArgs[])
     {
-	JarTools.initialise(this); 
+	Gatherer gatherer = null;
+	JarTools.initialise(WebGatherer.class); 
+	
+	String gwcgi_arg = null;
+	String gsdl3_arg = "false"; // String, "true" or "false"
+	String windowsHome_arg = null;
+	String debug_arg = "false"; // String, "true" or "false"
+	
+	for(int i = 0; i<cmdArgs.length; i++) {
+		///System.err.println("*** cmdarg " + i + " = " + cmdArgs[i]);
+		
+		if(cmdArgs[i].contains("gwcgi=")) {
+			gwcgi_arg = getParameter(cmdArgs[i], "gwcgi=");
+		} else if(cmdArgs[i].contains("gsdl3=")) {
+			gsdl3_arg = getParameter(cmdArgs[i], "gsdl3=");
+		} else if(cmdArgs[i].contains("windowsHome=")) {
+			windowsHome_arg = getParameter(cmdArgs[i], "windowsHome=");
+		} else if(cmdArgs[i].contains("debug=")) {
+			debug_arg = getParameter(cmdArgs[i], "debug=");
+		}
+	}
+	
+	///System.err.println("*** gwcgi_arg = " + gwcgi_arg);
+	///System.err.println("*** gsdl3_arg = " + gsdl3_arg);
+	// More debugging:
+	Map<String,String> envMap = System.getenv();
+	Set<Map.Entry<String,String>> entries = envMap.entrySet();
+	Iterator<Map.Entry<String, String>> i = entries.iterator();
+	System.err.println("*** ENVIRONMENT: ");
+	while(i.hasNext()) {
+		Map.Entry<String, String> entry = i.next();
+		String key = entry.getKey();
+		String value = entry.getValue();
+		System.err.println("*** key = " + key);
+		System.err.println("*** val = " + value);
+	}
+	// End debugging
 
 	// Check if the user has agreed to the requested security settings
@@ -81,5 +123,5 @@
 	}
 	catch (Exception exception) {
-	    getContentPane().add(new JLabel("Greenstone Librarian Interface Applet deactivated", JLabel.CENTER));
+	    System.err.println("Greenstone Librarian Interface Applet deactivated");
 	    return;
 	}
@@ -97,5 +139,5 @@
 	String gli_user_directory_path = System.getProperty("user.home") + File.separator;
         if (Utility.isWindows()) {
-	    String windows_home_parameter = getParameter("windowsHome");
+	    String windows_home_parameter = windowsHome_arg;
 	    if (windows_home_parameter != null && !windows_home_parameter.equals("")) {
 		gli_user_directory_path = windows_home_parameter + File.separator + "GLI" + File.separator;
@@ -114,8 +156,8 @@
 
 	// Set some global variables so we know how we're running
-	Gatherer.isApplet = true;
-	String library_url_string = fullLibraryURL(getParameter("gwcgi"));
-
-	String gs3 = getParameter("gsdl3");
+	Gatherer.isApplet = false;
+	String library_url_string = fullLibraryURL(gwcgi_arg);
+
+	String gs3 = gsdl3_arg;
 	boolean isGS3 = (gs3 == null || !gs3.equals("true")) ? false : true;
 
@@ -127,5 +169,5 @@
 	}
 
-        // String debug_param = getParameter("debug");
+        // String debug_param = debug_arg;
         // if ((debug_param != null) && (debug_param.matches("true"))) {
         //     go.debug = true;
@@ -183,31 +225,4 @@
 
 
-    public void start() 
-    {
-	System.err.println("Start called");
-    }
-
-
-    public void stop()
-    {
-	System.err.println("Stop called");
-    }
-
-
-    public void destroy()
-    {
-	System.err.println("Destroy called");
-	gatherer.exit();
-	gatherer = null;
-	System.err.println("Done gatherer exit.");
-    }
-
-
-    public void actionPerformed(ActionEvent e)
-    {
-	gatherer.openGUI();
-    }
-
-
     /** 
      * Method which unzips a given metadata resource.
Index: /main/trunk/gli/src/org/greenstone/gatherer/util/JarTools.java
===================================================================
--- /main/trunk/gli/src/org/greenstone/gatherer/util/JarTools.java	(revision 32138)
+++ /main/trunk/gli/src/org/greenstone/gatherer/util/JarTools.java	(revision 32139)
@@ -42,6 +42,11 @@
 
     static public void initialise(Object root_object)
+    {	
+	initialise(root_object.getClass());
+    }
+	
+	static public void initialise(Class rootClass)
     {
-	root_class = root_object.getClass();
+	root_class = rootClass;
 	ERROR_ICON = getImage("error.gif");
     }
