java - Make jar to ask for admin rights when it is launched


Keywords:java 


Question: 

This question already has an answer here:


1 Answer: 

You can't make the jar ask for admin access.

Instead, create a shortcut to java.exe -jar myjar.jar, then edit the shortcut properties, click the "Advanced..." button and check "Run as administrator".

Now, double-clicking the shortcut to run your jar file will always run as administrator.