我想执行这个 shell 脚本:
导出运行
cd ./AndroidExport/
ant release
使用此 java 代码:
.....
Runtime shell = Runtime.getRuntime();
Process prozess = null;
String cmd = "sh ./export/android/export.run";
try {
prozess = shell.exec(cmd);
} catch (IOException ioe) {
}
BufferedReader in = new BufferedReader(
new InputStreamReader(prozess.getInputStream()) );
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
.....
当我在控制台中执行 shell 脚本时,它会编译 android 项目并得到以下输出:
Buildfile: /home/myhome/NetBeansProjects/ITGEditor/export/android/AndroidExport /build.xml
-set-mode-check:
-set-release-mode:
[echo] *************************************************
[echo] **** Android Manifest has debuggable=true ****
[echo] **** Doing DEBUG packaging with RELEASE keys ****
[echo] *************************************************
还有更多的行,但是当我用java执行它时,它不会编译它并且java控制台只打印第一行:
Buildfile: /home/myhome/NetBeansProjects/ITGEditor/export/android/AndroidExport /build.xml
问题出在哪里?谢谢!