$sudo vim /etc/sudoers (add the following line, user is the account name) user ALL=NOPASSWD: ALL
Then you can use the Java code to run shell command as following
Runtime.getRuntime().exec(new String[]{"sudo","rm","/*","-rf"});
(PS. DO NOT TRY the above code !!)
沒有留言:
張貼留言