开发者

Java CreateProcess Error in Windows 7 UAC

I'm not able to programatically launch an Exe on a Windows 7 64-bit workstation. If UAC is off then the Exe will be launched from the bean. If UAC is on then the java console reports CreateProcess error=740, The requested operation requires elevation.

A java bean is launching the Exe on the workstation using

Process p = rt.exec(args);

Have also the ProcessBuilder clas开发者_高级运维s.
ProcessBuilder p = new ProcessBuilder(new String[] { "cmd.exe", "/C", m_sProg, m_sParams});

Thanks.


Your .exe seems to be requiring elevation via embedded manifest. To start it, you have to use ShellExecute or ShellExecuteEx WinAPI function.

You can try to overcome this restriction by using start command:

new ProcessBuilder(new String[] { "cmd.exe", "/C", "start", m_sProg, m_sParams});

If you can change the .exe your launching, then removing requestedExecutionLevel from the manifest might be an option unless the .exe really requires administrator privileges to run.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜