是否有可能调用shellscript或shellcode中的java类?在java中调用shell脚本?
我的代码(在一个静态方法):
Runtime rtime = Runtime.getRuntime();
Process child = rtime.exec("/bin/bash");
BufferedWriter outCommand = new BufferedWriter(new
OutputStreamWriter(child.getOutputStream()));
outCommand.write("streamer -c /dev/video0 -b32 -o test.jpeg");
outCommand.flush();
outCommand.close();
child.destroy();
,但我得到这个错误,如果我在jsp页面(tomcat6中)试试这个代码:
java.security.AccessControlException:访问(java.io.FilePermission/bin/bash execute)
这个问题的任何解决方案?
EDIT: LS -l /斌/庆典显示我follwing线:
-rwxr-XR-X 1根根875596 2009-09-14 07:09 /斌/庆典
谢谢
您使用的是Tomcat的打包版本吗?如果是的话,它具有非常严格的权限。 – 2010-09-18 22:55:42
嗯..不知道下载apt-get安装tomcat6 – Benni 2010-09-18 23:05:04