Changeset 24388


Ignore:
Timestamp:
2011-08-10T18:54:49+12:00 (11 years ago)
Author:
ak19
Message:

Fixed bug in starting and stopping GS3 server on Windows.

Location:
main/trunk/gli/src/org/greenstone/gatherer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/Gatherer.java

    r24358 r24388  
    373373                }
    374374                else {
    375                     GS3ServerThread thread = new GS3ServerThread(gsdl_path, "start");
     375                    GS3ServerThread thread = new GS3ServerThread(gsdl3_src_path, "restart");
    376376                    thread.start();
    377377                }
     
    715715            String shellCommand = null;
    716716            Process p = null;
    717             if (Utility.isWindows()) {             
    718                 p = Runtime.getRuntime().exec("cmd /C \"cd " + Configuration.gsdl_path + File.separator + ".. && ant stop\"\"");   
     717            if (Utility.isWindows()) {
     718                // cmd /C "cd "C:\path\to\greenstone3" && ant stop"
     719                p = Runtime.getRuntime().exec("cmd /C \"cd \"" + Configuration.gsdl3_src_path + File.separator + "\" && ant stop\"");   
    719720            } else {
    720                 p = Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", "ant stop -f \"" + Configuration.gsdl_path + ".." + File.separator + "build.xml\""});
     721                p = Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", "ant stop -f \"" + Configuration.gsdl3_src_path + File.separator + "build.xml\""});
    721722            }
    722723            } catch(Exception e) {
  • main/trunk/gli/src/org/greenstone/gatherer/util/GS3ServerThread.java

    r24333 r24388  
    4242public class GS3ServerThread extends Thread
    4343{
    44     String _gsdl_path = "";
     44    String _gsdl3_src_path = "";
    4545    String _ant_command = "";
    4646   
    47     public GS3ServerThread(String gsdl_path, String ant_command)
     47    public GS3ServerThread(String gsdl3_src_path, String ant_command)
    4848    {
    49     _gsdl_path = gsdl_path;
    50     _ant_command = ant_command;
     49    _gsdl3_src_path = gsdl3_src_path;
     50    _ant_command = ant_command; // "restart"
    5151    }
    5252   
     
    6262                _ant_command = "start";
    6363            }
    64             p = Runtime.getRuntime().exec("cmd /C \"cd " + _gsdl_path + File.separator + ".. && ant " + _ant_command + "\"\"");
     64            // The path in quotes, and the entire sequence of commands in quotes as well
     65            // E.g. the following works: cmd /C "cd "C:\path\to\greenstone3" && ant stop"
     66            // and it preserves any spaces in the path to GSDL3SRCHOME (_gsdl3_src_path).
     67            p = Runtime.getRuntime().exec("cmd /C \"cd \"" + _gsdl3_src_path + File.separator + "\" && ant " + _ant_command + "\"");   
    6568            }
    6669        else
     
    6972                _ant_command = "restart";
    7073            }
    71             p = Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", "ant " + _ant_command + " -f \"" + _gsdl_path + ".." + File.separator + "build.xml\""});
     74            p = Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", "ant " + _ant_command + " -f \"" + _gsdl3_src_path + File.separator + "build.xml\""});
    7275            }
    7376        }
Note: See TracChangeset for help on using the changeset viewer.