-2

I can get my terminal to show up but I can't get my code to run: and always get the exception. Any idea what's wrong?

if (e.getActionCommand() == "Start") {
String command= "/usr/bin/pg_ctl -D /var/lib/pgsql/data -l /var/lib/pgsql/log/pgsql.log     start"; 
Runtime rt = Runtime.getRuntime(); 
try {
rt.exec(command);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433

1 Answers1

2

It is mentioned in Runtime docs that if you want to execute command and arguments you need to pass it as a String array exec(String[] cmdarray)

Runtime doc

RanRag
  • 48,359
  • 38
  • 114
  • 167