package net.tplusplus.repository.derby.sql;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class StartServer
{
public static final String DERBY_PATH = "/Applications/db-derby-10.4.2.0-bin";
public static void main(String[] args) throws IOException
{
String startupPath = DERBY_PATH + "/bin/startNetworkServer";
String[] envp = new String[]
{
"DERBY_HOME=/Applications/db-derby-10.4.2.0-bin"
};
//System.setProperties(props);
Process p = Runtime.getRuntime().exec(startupPath,envp);
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
// read the output from the command
String line;
System.out.println("Here is the standard output of the command:\n");
while ((line = stdInput.readLine()) != null)
{
System.out.println(line);
}
// read any errors from the attempted command
System.out.println("Here is the standard error of the command (if any):\n");
while ((line = stdError.readLine()) != null)
{
System.out.println(line);
}
System.exit(0);
}
}
Wednesday, 10 December 2008
Starting Derby Using Java Code
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment