开发者

Java protect application from writing on disk

开发者 https://www.devze.com 2022-12-18 21:14 出处:网络
I have a problem with running a Java app (B) from my app (A). Code I use: String[] cmd = {\"/bin/sh\", \"-c\", \"java -Xmx16M -Xms2M -cp /root/ \" + B + \"> output.data\"};

I have a problem with running a Java app (B) from my app (A). Code I use:

String[] cmd = {"/bin/sh", "-c", "java -Xmx16M -Xms2M -cp /root/ " + B + "> output.data"};
Runtime rt = Runtime.getRuntime();
final Process proc = rt.exec(cmd);
Thread.sleep(1000);
pr开发者_如何学Coc.destroy();

I must stop app (B) from accessing my disk (write/read). How to do so?


This is possible by using a security manager as described in the Java tutorials.

0

精彩评论

暂无评论...
验证码 换一张
取 消