Index: main/trunk/gli/GLIapplet.jnlp
===================================================================
--- main/trunk/gli/GLIapplet.jnlp	(revision 32136)
+++ main/trunk/gli/GLIapplet.jnlp	(revision 32136)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ *    Java Web Start support for Greenstone Librarian Interface (GLI) applet.
+ *    Copyright (C) 2002 New Zealand Digital Library, http://www.nzdl.org
+ *
+ *    This program is free software; you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation; either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    This program is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with this program; if not, write to the Free Software
+ *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+-->
+<!--
+/*
+ *	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 -->
+<jnlp
+  spec="1.0+"
+  codebase="http://localhost:8383/greenstone3/applet"
+  href="GLIapplet.jnlp">
+  <information>
+    <title>Greenstone Librarian Interface</title>
+    <vendor>New Zealand Digital Library</vendor>
+    <homepage href="http://www.nzdl.org/"/>
+    <description>GLI</description>
+    <description kind="short">Greenstone Librarian Interface (GLI) applet via JNLP support</description>
+    <offline-allowed/>
+  </information>
+  <resources>
+    <j2se version="1.7+"/>
+    <jar href="SignedGatherer.jar"/>
+  </resources>
+  <!--<application-desc main-class="org.greenstone.gatherer.WebGatherer"/>-->
+  <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>
+    <all-permissions/>
+  </security>
+</jnlp> 
Index: main/trunk/gli/README_WebGLI.txt
===================================================================
--- main/trunk/gli/README_WebGLI.txt	(revision 32136)
+++ main/trunk/gli/README_WebGLI.txt	(revision 32136)
@@ -0,0 +1,64 @@
+--------------------------
+README 
+--------------------------
+Java Web Start version of GLI applet using our new JNLP file
+
+1. Follow the instructions at http://wiki.greenstone.org/doku.php?id=en:release:3.08_release_notes#setting_up_a_remote_greenstone_3_server for setting up the Remote GS Server and the GLI applet. This will have generated SignedGatherer.jar in the gli folder.
+2. Move the SignedGatherer.jar and the GLIapplet.jnlp JNLP file into GS3's web/applet folder. Edit GLIapplet.jnlp if necessary.
+3. Need to associate JNLP files with Java Web Start (jre/bin/javaws). On Windows, create the association in the usual way. For Linux, create a file with .desktop extension (e.g. javawebstart.desktop) containing the content a little further below. Then put the *.desktop file into ~/.local/share/applications
+4. Launch the Java Control Panel (jre/bin/javaclp.exe on Windows, ./.../jre/bin/ControlPanel on Linux). Go to the Security tab, set Security level to "High" if not already set. Click Edit Site List, and then press Add to add the host:port that the GS3 will run on.
+5. Once the GS3 code is compiled up, start up the GS3 web server and visit http://localhost:8383/greenstone3/library?a=p&sa=gli4gs3
+In the current version of the code, the GLI applet will load if the browser still supports applets. Otherwise, the fallback text will appear and provide a link to the GLIapplet.jnlp file. Since you should have set up the jnlp file association in step 3 above, you can now click on the GLIapplet.jnlp link and it should first download the jnlp file to a temporary user area (C:\Users\<user>\AppData\Local\Temp on windows) and then Java Web Start will be used to launch this JNLP file.
+6. After authorising the GLI to run, the JNLP version of the GLI Applet will eventually run and behave like the usual client-GLI/GLI applet from this point onward. 
+
+-----------
+# javawebstart.desktop
+# This file makes Ubuntu associate .jnlp files with Java Web Start (javaws)
+# This file should be adjusted and then copied into ~/.local/share/applications
+# as a file with .desktop extension, e.g. javawebstart.desktop
+# https://askubuntu.com/questions/235861/how-to-associate-jnlp-file-with-javaws
+[Desktop Entry]
+Encoding=UTF-8
+Name=Java 7 Web Start
+Comment=Java 7 Web Start
+Exec=/home/greenstone/Desktop/linux/jre/bin/javaws %u
+Terminal=false
+Type=Application
+Icon=javaws
+Categories=Application;Network;
+MimeType=application/x-java-jnlp-file;
+
+----------------------
+LINKS
+----------------------
+Reading on Java Web Start and Java Native Launch protocol (JNLP). The relationship between Java Web Start and JNLP:
+https://docs.oracle.com/cd/E84882_01/otn/pdf/E84699_01.pdf
+"Java Web Start is a technology that builds on the file association facilities of browsers through the use of Java Native Launch Protocol."
+ 
+
+Google search: Migrate Java 1.9 webstart
+
+https://docs.oracle.com/javase/9/whatsnew/toc.htm#JSNEW-GUID-9205ABFD-2024-40C8-B01E-A7328BBE4276
+https://docs.oracle.com/javase/9/deploy/migrating-java-applets-jnlp.htm#JSDPG-GUID-6B65096D-49F3-4AE2-B9ED-F8137A9B4D9E
+https://docs.oracle.com/javase/9/deploy/self-contained-application-packaging.htm#JSDPG592
+http://www.oracle.com/technetwork/java/javase/migratingfromapplets-2872444.pdf
+https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/applet_dev_guide.html#JSDPG1032
+https://dzone.com/articles/java-web-start-jnlp-hello
+
+https://docs.oracle.com/javase/tutorial/uiswing/examples/misc/index.html
+https://bugs.openjdk.java.net/browse/JDK-8178799
+https://www.v3.co.uk/v3-uk/news/2443810/oracle-signals-the-end-of-java-applet-support-for-browsers
+https://schneide.wordpress.com/2016/10/11/the-migration-path-for-java-applets/
+https://docs.oracle.com/javase/9/deploy/jnlp-file-syntax.htm#JSDPG-GUID-A935D448-EA5A-42E0-B103-DD02ECAD1436
+https://docs.oracle.com/javase/tutorial/deployment/deploymentInDepth/embeddingJNLPFileInWebPage.html
+https://stackoverflow.com/questions/7313317/jnlp-as-a-applet-in-html-page
+
+https://stackoverflow.com/questions/17338711/jarsigner-manifest-permissions
+https://stackoverflow.com/questions/19659134/how-do-i-fix-missing-codebase-permissions-and-application-name-manifest-attri
+https://docs.oracle.com/javase/7/docs/technotes/guides/jweb/security/manifest.html#codebase
+https://docs.oracle.com/javase/tutorial/deployment/jar/modman.html
+https://docs.oracle.com/javase/tutorial/deployment/jar/build.html
+https://stackoverflow.com/questions/18907695/ioexception-invalid-header-field-when-creating-jar-file-with-manifest
+https://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html
+https://docs.oracle.com/javase/8/docs/technotes/guides/jar/jar.html#JARManifest
+https://community.oracle.com/thread/1536875?start=0
Index: main/trunk/gli/makejar.bat
===================================================================
--- main/trunk/gli/makejar.bat	(revision 32135)
+++ main/trunk/gli/makejar.bat	(revision 32136)
@@ -165,6 +165,9 @@
 :: include all the properties (and other loose) files in the toplevel classes directory into the GLI.jar
 :: (Do something similar to get any and all folders inside the toplevel jar folder included into GLI.jar?)
-"%JARPATH%\jar" cf GLI.jar .java.policy metadata.zip %optional% help %propfiles% -C classes images -C classes xml -C jar com -C jar de -C jar org -C jar javax
-
+:: Note that order of manifest and jar file should match order of "mf" vs "fm" params to jar command
+"%JARPATH%\jar" cmf manifest.mf GLI.jar .java.policy metadata.zip %optional% help %propfiles% -C classes images -C classes xml -C jar com -C jar de -C jar org -C jar javax
+
+:: Not (yet) included in the new manifest.mf:
+:: Codebase: http://localhost:8383/greenstone3/applet
 
 :: Tidy up
Index: main/trunk/gli/manifest.mf
===================================================================
--- main/trunk/gli/manifest.mf	(revision 32136)
+++ main/trunk/gli/manifest.mf	(revision 32136)
@@ -0,0 +1,4 @@
+Created-By: 1.3.0 (Sun Microsystems Inc.)
+Main-Class: org.greenstone.gatherer.Gatherer
+Application-Name: Greenstone Librarian Interface
+Permissions: all-permissions
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/PageAction.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/PageAction.java	(revision 32135)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/PageAction.java	(revision 32136)
@@ -427,7 +427,15 @@
 		gsdl3_param_elem.setAttribute("value", "true");
 		applet_elem.appendChild(gsdl3_param_elem);
-		
-		Node default_text = doc.createTextNode("GLI applet");
+				
+		// When an applet doesn't work in the browser, set the default display text to provide a link to the JNLP file to run with Java Web Start
+		// The display text will be:
+		// 		Applets don't seem to work in your browser. In place of the GLI Applet, try running its alternative <a href="applet/GLIapplet.jnlp">Java Web Start (JNLP) version</a>
+		Node default_text = doc.createTextNode("Applets don't seem to work in your browser. In place of the GLI Applet, try running its alternative ");
+		Element link_to_jnlp = doc.createElement("a");
+		link_to_jnlp.setAttribute("href", "applet/GLIapplet.jnlp");
+		Node anchor_text = doc.createTextNode("Java Web Start (JNLP) version");
+		link_to_jnlp.appendChild(anchor_text);		
 		applet_elem.appendChild(default_text);
+		applet_elem.appendChild(link_to_jnlp);
 		
 		return page_response;
