Index: /trunk/gli/src/org/greenstone/gatherer/Gatherer.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/Gatherer.java	(revision 8621)
+++ /trunk/gli/src/org/greenstone/gatherer/Gatherer.java	(revision 8622)
@@ -185,9 +185,9 @@
 	    if (Utility.isWindows() && local_library_path != null && !GS3) {
 		LocalLibraryServer.start(gsdl_path, local_library_path);
+		DebugStream.println("Having started server.exe, exec_address is: " + Configuration.exec_address);
 	    }
 
 	    // Having loaded the configuration (necessary to determine if certain warnings have been disabled) and dictionary, we now check if the necessary path variables have been provided.
-	    if (local_library_path == null && Configuration.exec_address == null) {
-		DebugStream.println("local_library_path is null");
+	    if (Configuration.exec_address == null) {
 		DebugStream.println("config.exec_address is null");
 		missingEXEC();
Index: /trunk/gli/src/org/greenstone/gatherer/LocalLibraryServer.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/LocalLibraryServer.java	(revision 8621)
+++ /trunk/gli/src/org/greenstone/gatherer/LocalLibraryServer.java	(revision 8622)
@@ -33,10 +33,13 @@
 import javax.swing.*;
 import org.greenstone.gatherer.util.GSDLSiteConfig;
-import org.greenstone.gatherer.util.Utility;
 
 
 public class LocalLibraryServer
 {
-    static private GSDLSiteConfig gsdlsite_cfg = null;
+    static final private String ADD_COMMAND = "?a=config&cmd=add-collection&c=";
+    static final private String RELEASE_COMMAND = "?a=config&cmd=release-collection&c=";
+    static final private String QUIT_COMMAND = "?a=config&cmd=kill";
+
+    static private GSDLSiteConfig gsdlsite_cfg_file = null;
     static private boolean running = false;
 
@@ -44,5 +47,5 @@
     static public void addCollection(String collection_name)
     {
-	config(GSDLSiteConfig.ADD_COMMAND + collection_name);
+	config(ADD_COMMAND + collection_name);
 	// This is very important -- it ensures that the above command has finished
 	config("");
@@ -57,10 +60,8 @@
     {
 	try {
-	    String raw_url = Configuration.exec_address.toString() + command;
-	    URL url = new URL(raw_url);
-	    DebugStream.println("Action: " + raw_url);
+	    URL url = new URL(Configuration.exec_address.toString() + command);
 	    HttpURLConnection library_connection = (HttpURLConnection) url.openConnection();
 	    int response_code = library_connection.getResponseCode();
-	    if(HttpURLConnection.HTTP_OK <= response_code && response_code < HttpURLConnection.HTTP_MULT_CHOICE) {
+	    if (response_code >= HttpURLConnection.HTTP_OK && response_code < HttpURLConnection.HTTP_MULT_CHOICE) {
 		DebugStream.println("200 - Complete.");
 	    }
@@ -68,5 +69,4 @@
 		DebugStream.println("404 - Failed.");
 	    }
-	    url = null;
 	}
 	catch (Exception ex) {
@@ -84,5 +84,5 @@
     static public void releaseCollection(String collection_name)
     {
-	config(GSDLSiteConfig.RELEASE_COMMAND + collection_name);
+	config(RELEASE_COMMAND + collection_name);
 	// This is very important -- it ensures that the above command has finished
 	config("");
@@ -92,9 +92,10 @@
     static public void start(String gsdl_path, String local_library_server_file_path)
     {
+	// Check the local library server.exe file exists
 	File local_library_server_file = new File(local_library_server_file_path);
 	if (!local_library_server_file.exists()) {
 	    DebugStream.println("No local library at given file path.");
 
-	    local_library_server_file = new File(gsdl_path + Utility.SERVER_EXE);
+	    local_library_server_file = new File(gsdl_path + "server.exe");
 	    if (!local_library_server_file.exists()) {
 		DebugStream.println("No local library at all.");
@@ -103,117 +104,111 @@
 	}
 
-	// First of all we create a GSDLSiteCFG object and check if a URL is already present, in which case the server is already running.
-	gsdlsite_cfg = new GSDLSiteConfig(local_library_server_file);
-	String url = gsdlsite_cfg.getURL();
-	// If its already running then set exec address.
-	if(url != null) {
+	// Check if the server is already running
+	gsdlsite_cfg_file = new GSDLSiteConfig(local_library_server_file);
+	String url = gsdlsite_cfg_file.getURL();
+	if (url != null) {
+	    // If it is already running then set the Greenstone web server address and we're done
 	    try {
 		Configuration.exec_address = new URL(url);
-	    }
-	    catch(Exception error) {
-	    }
-	}
-	// Otherwise its time to run the server in a spawned process.
-	if(Configuration.exec_address == null && local_library_server_file.exists()) {
-	    // Configure for immediate entry. Note that this only works if the gsdlsite.cfg file exists.
-	    gsdlsite_cfg.set();
-
-	    // Spawn local library server process
-	    String local_library_server_command = local_library_server_file.getAbsolutePath() + " " + gsdlsite_cfg.getSiteConfigFilename();
-	    Gatherer.self.spawnApplication(local_library_server_command);
-
-	    // Now we have to wait until program has started. We do this by reloading and checking
-	    ///ystem.err.print("Waiting until the local library has loaded");
+		return;
+	    }
+	    catch (MalformedURLException exception) {
+		DebugStream.printStackTrace(exception);
+	    }
+	}
+
+	// Configure the server for immediate entry
+	gsdlsite_cfg_file.set();
+
+	// Spawn local library server process
+	String local_library_server_command = local_library_server_file.getAbsolutePath() + " " + gsdlsite_cfg_file.getSiteConfigFilename();
+	Gatherer.self.spawnApplication(local_library_server_command);
+
+	// Wait until program has started, by reloading and checking the URL field
+	gsdlsite_cfg_file.load();
+	int attempt_count = 0;
+	while (gsdlsite_cfg_file.getURL() == null) {
+	    new OneSecondWait();  // Wait one second (give or take)
+	    gsdlsite_cfg_file.load();
+	    attempt_count++;
+
+	    // After waiting a minute ask the user whether they want to wait another minute
+	    if (attempt_count == 60) {
+		int try_again = JOptionPane.showConfirmDialog(Gatherer.g_man, Dictionary.get("Server.QuitTimeOut"), Dictionary.get("General.Warning"), JOptionPane.YES_NO_OPTION);
+		if (try_again == JOptionPane.NO_OPTION) {
+		    return;
+		}
+		attempt_count = 0;
+	    }
+	}
+
+	// Ta-da. Now the url should be available
+	try {
+	    Configuration.exec_address = new URL(gsdlsite_cfg_file.getURL());
+	}
+	catch (MalformedURLException exception) {
+	    DebugStream.printStackTrace(exception);
+	}
+
+	// A quick test involves opening a connection to get the home page for this collection
+	try {
+	    DebugStream.println("Try connecting to server on config url: '" + Configuration.exec_address + "'");
+	    URLConnection connection = Configuration.exec_address.openConnection();
+	    connection.getContent();
+	}
+	catch (IOException bad_url_connection) {
 	    try {
-		gsdlsite_cfg.load();
-		    
-		int try_again = JOptionPane.YES_OPTION;
-		int attempt_count = 0;
-		while(gsdlsite_cfg.getURL() == null && try_again == JOptionPane.YES_OPTION) {
-		    ///ystem.err.print(".");
-		    if(attempt_count == 60) {
-			attempt_count = 0;
-			try_again = JOptionPane.showConfirmDialog(Gatherer.g_man, Dictionary.get("Server.QuitTimeOut"), Dictionary.get("General.Warning"), JOptionPane.YES_NO_OPTION);
-		    }
-		    else {
-			new OneSecondWait();  // Wait one second (give or take)
-			gsdlsite_cfg.load();
-			attempt_count++;
-		    }
+		// If this fails then we try changing the url to be localhost
+		Configuration.exec_address = new URL(gsdlsite_cfg_file.getLocalHostURL());
+		DebugStream.println("Try connecting to server on local host: '" + Configuration.exec_address + "'");
+		URLConnection connection = Configuration.exec_address.openConnection();
+		connection.getContent();
+	    }
+	    catch (IOException worse_url_connection) {
+		DebugStream.println("Can't connect to server on either address.");
+		Configuration.exec_address = null;
+	    }
+	}
+    }
+
+
+    static public void stop()
+    {
+	if (running == false) {
+	    return;
+	}
+
+	// Send the command for it to exit.
+	config(QUIT_COMMAND);
+	config("");
+
+	// Wait until program has started, by reloading and checking the URL field
+	gsdlsite_cfg_file.load();
+	int attempt_count = 0;
+	while (gsdlsite_cfg_file.getURL() != null) {
+	    new OneSecondWait();  // Wait one second (give or take)
+	    gsdlsite_cfg_file.load();
+	    attempt_count++;
+
+	    // After waiting a minute ask the user whether they want to wait another minute
+	    if (attempt_count == 60) {
+		int try_again = JOptionPane.showConfirmDialog(Gatherer.g_man, Dictionary.get("Server.QuitTimeOut"), Dictionary.get("General.Warning"), JOptionPane.YES_NO_OPTION);
+		if (try_again == JOptionPane.NO_OPTION) {
+		    return;
 		}
-		    
-		if((url = gsdlsite_cfg.getURL()) != null) {
-		    // Ta-da. Now the url should be available.
-		    Configuration.exec_address = new URL(url);
-			
-		    // A quick test involves opening a connection to get the home page 	for this collection. If this fails then we try changing the url to be localhost.
-		    try {
-			DebugStream.println("Try connecting to server on config url: '" + Configuration.exec_address + "'");
-			URLConnection connection = Configuration.exec_address.openConnection();
-			connection.getContent();
-		    }
-		    catch(IOException bad_url_connection) {
-			try {
-			    DebugStream.println("Try connecting to server on local host: '" + gsdlsite_cfg.getLocalHostURL() + "'");
-			    Configuration.exec_address = new URL(gsdlsite_cfg.getLocalHostURL	());
-			    URLConnection connection = Configuration.exec_address.openConnection();
-			    connection.getContent();
-			}
-			catch(IOException worse_url_connection) {
-			    DebugStream.println("Can't connect to server on either address.");
-			    Configuration.exec_address = null;
-			}
-		    }
-		}
-	    }
-	    catch (Exception exception) {
-		DebugStream.printStackTrace(exception);
-	    }
-	}
-	DebugStream.println("Having started server.exe, exec_address is: " + Configuration.exec_address);
-    }
-
-
-    static public void stop()
-    {
-	if (running == true && Configuration.exec_address != null) {
-	    // See if its already exited for some reason.
-	    gsdlsite_cfg.load();
-	    if(gsdlsite_cfg.getURL() != null) {
-		// Send the command for it to exit.
-		config(GSDLSiteConfig.QUIT_COMMAND);
-		// Wait until it exits.
-		try {
-		    gsdlsite_cfg.load();
-		    int try_again = JOptionPane.YES_OPTION;
-		    int attempt_count = 0;
-		    while(gsdlsite_cfg.getURL() != null && try_again == JOptionPane.YES_OPTION) {
-			if(attempt_count == 60) {
-			    attempt_count = 0;
-			    try_again = JOptionPane.showConfirmDialog(Gatherer.g_man, Dictionary.get("Server.QuitTimeOut"), Dictionary.get("General.Warning"), JOptionPane.YES_NO_OPTION);
-			}
-			else {
-			    new OneSecondWait();  // Wait one second (give or take)
-			    gsdlsite_cfg.load();
-			    attempt_count++;
-			}
-		    }
-		    //if(gsdlsite_cfg.getURL() != null) {
-		    //JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("Server.QuitManual"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
-		    //}
-		}
-		catch (Exception exception) {
-		    DebugStream.printStackTrace(exception);
-		}
-	    }
-	    // Restore the gsdlsite_cfg.
-	    if(gsdlsite_cfg != null) {
-		gsdlsite_cfg.restore();
-	    }
-	    // If the local server is still running then our changed values will get overwritten.
-	    if(gsdlsite_cfg.getURL() != null) {
-		JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("Server.QuitFailed"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
-	    }
-	    gsdlsite_cfg = null;
+		attempt_count = 0;
+	    }
+	}
+
+	//if(gsdlsite_cfg_file.getURL() != null) {
+	//JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("Server.QuitManual"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
+	//}
+
+	// Restore the gsdlsite_cfg.
+	gsdlsite_cfg_file.restore();
+
+	// If the local server is still running then our changed values will get overwritten.
+	if (gsdlsite_cfg_file.getURL() != null) {
+	    JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("Server.QuitFailed"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
 	}
     }
Index: /trunk/gli/src/org/greenstone/gatherer/util/GSDLSiteConfig.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/util/GSDLSiteConfig.java	(revision 8621)
+++ /trunk/gli/src/org/greenstone/gatherer/util/GSDLSiteConfig.java	(revision 8622)
@@ -10,9 +10,4 @@
     private String autoenter_initial;
     private String start_browser_initial;
-
-    static final public String ADD_COMMAND = "?a=config&cmd=add-collection&c=";
-    static final public String SPECIFIC_CONFIG = "--config=";
-    static final public String RELEASE_COMMAND = "?a=config&cmd=release-collection&c=";
-    static final public String QUIT_COMMAND = "?a=config&cmd=kill";
     
     static final private String AUTOENTER = "autoenter";
@@ -26,4 +21,5 @@
     static final private String PORTNUMBER = "portnumber";
     static final private String SEPARATOR = "/";
+    static final private String SPECIFIC_CONFIG = "--config=";
     static final private String STARTBROWSER = "start_browser";
     static final private String TRUE = "1";
Index: /trunk/gli/src/org/greenstone/gatherer/util/Utility.java
===================================================================
--- /trunk/gli/src/org/greenstone/gatherer/util/Utility.java	(revision 8621)
+++ /trunk/gli/src/org/greenstone/gatherer/util/Utility.java	(revision 8622)
@@ -148,5 +148,4 @@
     /** Definition of an important directory name, in this case the location of image and other resources. */
     static public String RES_DIR = BASE_DIR + "resource" + File.separator;
-    static final public String SERVER_EXE = "server.exe";
     /** Definition of an important directory name, in this case the location of opening (or welcome) screen html. */
     static public String WELCOME_DIR = BASE_DIR + "welcome" + File.separator;
