【请教】
java吧
全部回复
仅看楼主
level 8
关于java Runtime.exec()
我想java调用本地的一个exe程序
cmd命令为:String cmd = "openRTSP -4 -D 10 -w 640 -h 320 -f 15 rtsp://192.168.1.100:554/h264.sdp >>C:\Program Files\Darwin Streaming Server\Movies\test.mp4"
当我使用Runtime.exec(cmd);
得到的返回结果Runtime.exec(cmd).wateFor(); 为1...
如果正常应该返回0,并且在C:\Program Files\Darwin Streaming Server\Movies\可以看到test.mp4文件
直接将cmd 在控制台中测试,可以正确执行
用程序调用就出了问题~
具体代码 如下
Runtime rn = Runtime.getRuntime();
Process p = null;
String cmd = "openRTSP -4 -D 10 -w 640 -h 320 -f 15 rtsp://192.168.1.100:554/h264.sdp >>C:\Program Files\Darwin Streaming Server\Movies\test.mp4";
p = rn.exec(cmd);
int result = p.waitFor();
syso(result);
p.destory();
有了解的大神能帮忙看下么,卡了好久了..
2013年09月03日 04点09分 1
level 8
有大神么,进来讨论下啊[乖]
2013年09月03日 05点09分 2
level 6
楼主碉堡了。。。
2013年09月03日 05点09分 3
此话怎讲..[乖]
2013年09月03日 05点09分
level 11
你看一下api吧
2013年09月03日 05点09分 4
level 9
前面加上cmd \c 试试
2013年09月03日 05点09分 5
加 cmd \c 没有,相当于直接再打开一次 cmd ..
2013年09月03日 06点09分
回复 丶我是程序猿 :是啊,exec有时候不加cmd就不行的 输出错误log试试
2013年09月03日 06点09分
回复 gwg121212 :没有什么错误log..程序正常执行result应该为0,而这个返回的是1
2013年09月03日 06点09分
回复 丶我是程序猿 :我用同样的方法调用另外一个程序就可以,命令为: MP4Box.exe -ocr -hint "C:\Program Files\Darwin Streaming Server\Movies\865969010022705\video\rm\1.3gp" 这个就可以..
2013年09月03日 06点09分
1