Javafx 应用程序 运行 作为管理员

Javafx application run as administrator

大家好,我将以管理员身份参加 运行 java window 计划。我该怎么做? 我厌倦了这个 https://github.com/rritoch/ 超级用户应用程序 但它只有自己 class。我不喜欢这个。 java 运行 作为管理员的最佳解决方案是什么。谢谢!

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;
}

}

请使用 lanuch4j 并添加清单文件 您可以使用以下代码。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="highestAvailable"   uiAccess="False" />
</requestedPrivileges>
</security>
</trustInfo>
</assembly>