Androidでこれをやろうとしています:
Process p = Runtime.getRuntime().exec("sh");
DataOutputStream out = new DataOutputStream(p.getOutputStream());
out.writeBytes("something useful\n");
out.close();
p.waitFor();
out = new DataOutputStream(p.getOutputStream());
out.writeBytes("something useful\n");
out.close();
p.waitFor();
2 回目に out.writeBytes(); を実行します。、Java IOException: "Bad file number" が発生します。私のアプリはいくつかのネイティブ プログラムを実行する必要がありますが、常に同じプロセスを使用します。これが機能しない理由を知っている人はいますか?