您好,我將以管理員身份在窗口上運行java程序。我怎麼能做到這一點? 我累這https://github.com/rritoch/超級用戶應用程序 但它只有自己的類。我不喜歡這個。以管理員身份運行java的最佳解決方案是什麼?謝謝!以管理員身份運行Javafx應用程序
package com.vnetpublishing.java;
import com.vnetpublishing.java.suapp.SU;
import com.vnetpublishing.java.suapp.SuperUserApplication;
public class TestAdmin extends SuperUserApplication {
public static void main(String[] args) {
SU.run(new TestAdmin(), args);
}
public int run(String[] args) {
System.out.println("RUN AS ADMIN! YAY!");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return 0;
}
}
你可以參考這個答案[https://stackoverflow.com/questions/27332003/how-do-i-request-uac-administrative-privileges-with-a-javafx-desktop-application/44564485 #44564485](https://stackoverflow.com/questions/27332003/how-do-i-request-uac-administrative-privileges-with-a-javafx-desktop-application/44564485#44564485) –