Start Java Runtime Process with Administrator rights on Vista

本秂侑毒 提交于 2019-12-05 18:43:27
kaboom

(I have not tried this), but it seems that you can do this using the "elevate" program from here

also read this for UAC overview

After 2 days of testing i found the following solution.

The error comes up when the Vista UAC functionality is activated. UAC shows a question dialog everytime, when a process needs administrator rights.

Showing this dialog causes the issue.

Instead of using the old

process = rt.exec(fileToExecute, null, mFolder);

command, i am using now the new 1.5 ProcessBuilder command

EDIT:

To avoid the problem you have to open a command window which requests the permission. And than you have to call the external process.

ProcessBuilder builder = new ProcessBuilder(new String[] { "cmd.exe", "/C", fileToExecute });

Also described here Execute an external Program

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!