[問題] 在Linux底下執行外部程式?
我在Linux底下已經寫了一個簡單的helloworld執行檔
檔名叫helloworld
用途是print出一串helloworld
現在我要用java程式呼叫這個執行檔
這個Java程式檔名叫做helloworld.java
helloworld.java內容如下
import java.io.*;
public class helloworld{
public static void main(String[] args){
try{
String[] command={"/bin/sh","./helloworld"};
Runtime.getRuntime().exec(command);
}
catch(IOException e){
e.printStackTrace();
}
}
}
我的程式編譯執行後沒有反應
可以請有經驗的大大可以幫我看一下嗎?
在這邊先謝謝有經驗的前輩
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.116.177.31
※ CSLabor:轉錄至看板 Linux 10/30 14:59
→
10/30 15:21, , 1F
10/30 15:21, 1F
→
10/30 15:23, , 2F
10/30 15:23, 2F
→
10/30 15:23, , 3F
10/30 15:23, 3F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):