您好,我将以管理员身份在窗口上运行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) –