1

I need to elevate the permissions of a JavaFX desktop application. Not the .jnlp or the web version. This program will be deployed to desktops so

<fx:deploy
    ...
>
    <fx:application
        ...
    /><fx:resources>
        ...
    </fx:resources>
    <fx:preferences
        ...
    />
    <fx:info
        ...
    /><fx:permissions elevated = "true"/> <!--THIS DOESN'T WORK!!!-->
</fx:deploy>

won't work. I can get the program to run fine in my IDE, and when I deploy and set the properties of the application shortcut to run the program as administrator in Windows, that works fine too.

Evidently, according to my employer, anyway, it is too much to expect a user to do that (change the shortcut properties to launch the program as administrator) so I need another solution.

So what do I need to do to always make a JavaFX application request administrative privileges?

EDIT:

Also, using AccessController.doPrivileged(...) does not work either.

Will
  • 3,413
  • 7
  • 50
  • 107

1 Answers1

0

You can use lanuch4j that compile jar file to exe. add filename.manifest to basic/warpper manifest: it will work well as administrator on windows. I have tested on my javafx program.

<?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>  
X zheng
  • 1,731
  • 1
  • 17
  • 25
  • http://sourceforge.net/projects/launch4j/files/launch4j-3/3.1.0-beta2/ use this link lanuch4j download – X zheng Jun 15 '17 at 10:09