我想通過Java代碼執行一個exe文件。我在Eclipse中寫了一個簡單的代碼,但遇到了錯誤。嘗試了多種解決方案,但都是徒勞的。無法通過Java代碼運行的exe文件,在Selenium WebDriver
我的代碼:
package com.runExeFile;
import java.io.File;
public class ClassA {
public static void main(String[] args) throws Exception {
Runtime.getRuntime().exec("C:\\FlashBuild\\14_09_2017_play_27_0_r0_137\\FF_32Release\\Something.exe");
}
}
我得到的錯誤:
Exception in thread "main" java.io.IOException: Cannot run program "C:\FlashBuild\14_09_2017_play_27_0_r0_137\FF_32Release\install_flash_player_27_plugin.exe": CreateProcess error=740, The requested operation requires elevation
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at com.runExeFile.ClassA.main(ClassA.java:9)
Caused by: java.io.IOException: CreateProcess error=740, The requested operation requires elevation
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)`enter code here`
at java.lang.ProcessImpl.start(Unknown Source)
這是錯誤狀態:您必須以提升的權限運行程序。 – Jerrybibo
[CreateProcess error = 740,請求的操作需要提升]的可能重複(https://stackoverflow.com/questions/5853529/createprocess-error-740-the-requested-operation-requires-elevation) –