2012-01-10 3 views
-2

터미널이 나타나지만 실행할 코드를 가져올 수 없습니다. 항상 예외가 발생합니다. 어떤 생각이 잘못된거야?Java GUI를 통해 Linux 명령 실행

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(); 
} 
+5

을 제외하고 스택 추적을 게시하시기 바랍니다로 전달해야한다는 것을 Runtime docs에 언급되어있다. –

답변

2

는 당신이 command and arguments을 실행하려는 경우 String 배열 exec(String[] cmdarray)

Runtime doc

관련 문제