Index: /main/trunk/greenstone3/build.xml
===================================================================
--- /main/trunk/greenstone3/build.xml	(revision 30195)
+++ /main/trunk/greenstone3/build.xml	(revision 30196)
@@ -1855,5 +1855,5 @@
       <handler classname="org.apache.tools.ant.input.SecureInputHandler" /> <!-- password won't be visible on screen -->
     </input>
-    <input addproperty="user.groups" defaultvalue="" message="Groups (comma-separated list):&gt;"/>
+    <input addproperty="user.groups" defaultvalue="" message="Groups (comma-separated list, e.g. personal-collections-editor):&gt;"/>
     <input addproperty="user.status" defaultvalue="true" message="Enabled (true/false):&gt;"/>
     <input addproperty="user.comment" defaultvalue="" message="Comment:&gt;"/>
@@ -1889,4 +1889,5 @@
     <java classname="org.greenstone.gsdl3.util.ModifyUsersDB">
       <classpath refid="compile.classpath"/> <!--for ${web.lib}/gsdl3.jar and supporting files-->
+      <sysproperty key="gsdl3.writablehome" value="${gsdl3.writablehome}" /> <!-- passes -D<syspropKey=syspropVal> to java class ModifyUsersDB. Available in java code as System.getProperty("syspropKey") -->
       <arg file="${web.home}/etc/usersDB"/>
       <arg value="${user.username}"/>
Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/DerbyWrapper.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/DerbyWrapper.java	(revision 30195)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/DerbyWrapper.java	(revision 30196)
@@ -35,8 +35,32 @@
 public class DerbyWrapper
 {
-    static final String PORT = GlobalProperties.getProperty("derby.server.port", "1527");
-    static final String DERBYSERVER = GlobalProperties.getProperty("derby.server", "localhost");
-    static final String PROTOCOL = "jdbc:derby://"+DERBYSERVER+":"+PORT+"/"; // "jdbc:derby://localhost:1527";
-    static final String DRIVER = "org.apache.derby.jdbc.ClientDriver"; //"org.apache.derby.jdbc.EmbeddedDriver";
+    static final String PORT;
+    static final String DERBYSERVER;
+    static final String PROTOCOL;	
+
+    // static code block to initialise the above
+    static {
+	// GlobalProperties won't be loaded at this point if running ant config-admin or ant config-user 
+	// from the command line (both of which call ant update-userdb which in turn calls ModifyUsersDB.java)
+	// In such a case, the ant command will have set the system property (-Dgsdl3_writablehome) 
+	// and passed this to ModifyUsersDB.java. Use that to load the GlobalProperties at this point
+
+	if(GlobalProperties.getGSDL3Home() == null) { // testing whether GlobalProperties is already loaded
+	    String gsdl3_writablehome = System.getProperty("gsdl3.writablehome"); // set by 'ant update-userdb' cmd
+
+	    //System.err.println("@@@@@ writablehome: " + gsdl3_writablehome);
+	    GlobalProperties.loadGlobalProperties(gsdl3_writablehome);
+	}
+	
+	//System.err.println("@@@@@ GlobalProperties.getGSDL3Home(): " + GlobalProperties.getGSDL3Home()); //test
+	
+	// No more fallback values, use exactly what's propagated into global.properties from build.properties
+	PORT = GlobalProperties.getProperty("derby.server.port");//, "1527");
+	DERBYSERVER = GlobalProperties.getProperty("derby.server");//, "localhost");
+	PROTOCOL = "jdbc:derby://"+DERBYSERVER+":"+PORT+"/"; // "jdbc:derby://localhost:1527"; // by default
+    }
+   
+
+	static final String DRIVER = "org.apache.derby.jdbc.ClientDriver"; //"org.apache.derby.jdbc.EmbeddedDriver";
 	static final String USERSDB = "usersDB";
 	static final String USERS = "users";
Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/ModifyUsersDB.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/ModifyUsersDB.java	(revision 30195)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/ModifyUsersDB.java	(revision 30196)
@@ -23,6 +23,15 @@
 //import org.greenstone.admin.guiext.PropertiesStep;
 
-// To run this from the command-line, first make sure that the tomcat server is stopped, then run:
-// java -cp /full/path/to/GS3/web/WEB-INF/lib/gsdl3.jar:/full/path/to/GS3/web/WEB-INF/lib/derby.jar org.greenstone.gsdl3.util.usersDB2txt web/etc/usersDB/
+/** 
+    To run this from the command-line, first make sure that the networked derby server is running (ant start-derby),
+    then run:
+
+    java -Dgsdl3.writablehome=/Scratch/ak19/gs3-svn-2Sep2015/web -cp web/WEB-INF/lib/gsdl3.jar:web/WEB-INF/lib/gutil.jar:web/WEB-INF/lib/derby.jar:web/WEB-INF/lib/derbyclient.jar:web/WEB-INF/lib/log4j-1.2.8.jar:web/WEB-INF/lib/commons-codec-1.7.jar:web/WEB-INF/classes org.greenstone.gsdl3.util.ModifyUsersDB web/etc/usersDB/ <username> [options specifying user fields to change, e.g.: password=me!]
+    
+    Don't forget to stop the networked derby server again at the end, if you had started it: ant stop-derby
+
+    or if using embedded derby, ensure that tomcat is stopped, then run:
+    java -cp /full/path/to/GS3/web/WEB-INF/lib/gsdl3.jar:/full/path/to/GS3/web/WEB-INF/lib/derby.jar org.greenstone.gsdl3.util.ModifyUsersDB web/etc/usersDB/
+*/ 
 public class ModifyUsersDB
 {
Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/txt2usersDB.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/txt2usersDB.java	(revision 30195)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/txt2usersDB.java	(revision 30196)
@@ -27,4 +27,15 @@
 import org.greenstone.gsdl3.service.Authentication;
 
+/** 
+    To run this from the command-line, first make sure that the derby networked server is running (ant start-derby),
+    then run:
+
+    java -Dgsdl3.writablehome=/full/path/to/GS3/web -cp web/WEB-INF/lib/gsdl3.jar:web/WEB-INF/lib/gutil.jar:web/WEB-INF/lib/derby.jar:./web/WEB-INF/lib/derbyclient.jar:./web/WEB-INF/lib/log4j-1.2.8.jar:./web/WEB-INF/classes org.greenstone.gsdl3.util.txt2usersDB <filename>.txt web/etc/usersDB/ [-append]
+
+    Don't forget to stop the networked derby server again at the end, if you had started it: ant stop-derby
+
+    Or if using embedded derby, ensure that tomcat is stopped, then run:
+    java -cp /full/path/to/GS3/web/WEB-INF/lib/gsdl3.jar:/full/path/to/GS3/web/WEB-INF/lib/derby.jar org.greenstone.gsdl3.util.txt2usersDB <filename>.txt web/etc/usersDB/ [-append]
+*/
 public class txt2usersDB
 {
Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/usersDB2txt.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/usersDB2txt.java	(revision 30195)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/usersDB2txt.java	(revision 30196)
@@ -29,5 +29,18 @@
 import java.util.Properties;
 
-// Run as java org.greenstone.gsdl3.util.usersDB2txt <usersDB file>
+/** 
+    To run this from the command-line, first make sure that the networked derby server is running (ant start-derby)
+    then run: 
+ 
+    java -Dgsdl3.writablehome=/full/path/to/GS3/web -cp ./web/WEB-INF/lib/gsdl3.jar:./web/WEB-INF/lib/gutil.jar:./web/WEB-INF/lib/derby.jar:./web/WEB-INF/lib/derbyclient.jar:./web/WEB-INF/lib/log4j-1.2.8.jar:./web/WEB-INF/classes org.greenstone.gsdl3.util.usersDB2txt web/etc/usersDB/
+
+    if redirecting to a file append ">& filename.txt" to the above command 
+    since the usersDB2txt program output goes to System.err and needs to be redirected to the file too
+
+    Don't forget to stop the networked derby server again at the end, if you had started it: ant stop-derby
+
+    Or if using embedded derby, ensure that tomcat is stopped, then run:
+    java -cp /full/path/to/GS3/web/WEB-INF/lib/gsdl3.jar:/full/path/to/GS3/web/WEB-INF/lib/derby.jar org.greenstone.gsdl3.util.usersDB2txt web/etc/usersDB/ [>& <output file>]
+*/
 public class usersDB2txt
 {
