CreateProcess error=740, The requested operation requires elevation

匿名 (未验证) 提交于 2019-12-03 02:12:02

问题:

I have a web applet that I update regularly and I finally decided to make an updater. However when I download an update in java it downloads fine. However when I try to unpack + run the update by using Runtime.getRuntime().exec(pathToFile); I get CreateProcess error=740, The requested operation requires elevation

How can I fix this if the program is a web applet? I can't just tell them to run their browsers as administrators. How can i fix this?

回答1:

One of my friends was having this exact same problem about a month ago (he was unrolling an update via a .exe file), and I remember that this link helped him tremendously: http://mark.koli.ch/2009/12/uac-prompt-from-java-createprocess-error740-the-requested-operation-requires-elevation.html

I would make this simply a comment under your question (doesn't seem worthy of a straight up answer/solution), but I don't have enough rep yet to comment. :-P



回答2:

When using .exec(cmd), prefix your command with cmd /c so you end up with something like rt.exec("cmd /c <your command>"). This will launch the process and invoke the UAC if needed.



回答3:

One Manual work around one of our engineers found, if it is not your application, start a cmd prompt, right click on the window and click the "Run as Administrator" menu item. in my case running the .jnlp file work!



回答4:

I had the same issue, resolve it by running the java application as an administrator, to make it permanent: Right click on your application , go to property > Compatibility > check "Run this program as an administrator"

(I have a batch file runs Java.exe -jar ....)



回答5:

I've faced such problem too when tried to run app with command:

cmd /c start <exe_file> 

This command could not run executable that require Admin access. Instead use of

rundll32 url.dll,FileProtocolHandler <exe_file> 

command solved my problem. This command triggers UAC prompt, so user could provide correct access before app will be launched.

In my app I used PrecessBuilder::start() function. This function returns java.lang.Process instance which will be alive (process.isAlive() == true) until user will handle UAC prompt, so it's better to add some loop to wait until it happens to consider for sure that app is launched.



回答6:

Reason:

When you try to run your application, your IDE attempts to start adb but it ends up getting 740 process error or adb down because your IDE is not allowed to run an adb.exe file from your platform tools in your sdk folder.

Solution:

  1. Kill adb.exe, kill eclipse.exe from task manager in windows.
  2. Close eclipse and disconnects your phone and restart it and disable USB debugging and enable it again.
  3. Go to eclipse icon right click and choose run as administrator
  4. Connect it to your device and run your application.

A golden tip - always run your eclipse,sdk manager,command prompt as administrator so your system gives full permission to specific application.

tested on window 7 64bit

device Samsung 4.4 eclipse ide



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