-2

I need help in making my jar to ask for admin rights on load,when I run my jar file it does some manipulations to the system content(c:),But i have to run the application with admin rights. I tried using command prompt and it is working fine but it is painful to always load the jar into command prompt ,so I want to make my jar ask for admin previlages when it is launched :),No alternatives please. Thank you..

  • This likely will require to provide a executable wrapper with the correct manifest information to request an elevation in authority – MadProgrammer Feb 28 '18 at 04:02

1 Answers1

0

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.

Andreas
  • 154,647
  • 11
  • 152
  • 247
  • I want to share the file to our whole university ,they do not want to do this please I already said no alternatives..Tell me how to make jar to ask for admin privileges. – Vamsi Manohar Feb 28 '18 at 04:29
  • @VamsiManohar Please read my answer, in particular the **first sentence**. – Andreas Feb 28 '18 at 05:03
  • Thank you for your reply and Please make it clear to me how to create shortcut to jar with admin rights..:) – Vamsi Manohar Feb 28 '18 at 05:05
  • @VamsiManohar Please read my answer, in particular the **second paragraph**. – Andreas Feb 28 '18 at 05:06
  • Please Explain in detail thank you.. – Vamsi Manohar Feb 28 '18 at 05:37
  • 2
    With your right hand, move the mouse to a blank space on your desktop. Now, with your right middle finger, click the right mouse button. With your right hand, move the mouse down the popup menu, until the mouse is over the "New" entry. With your right hand, move the mouse to the right and then down, until the mouse is over the "Shortcut" entry. With your right index finger, click the left mouse button. Using fingers of your choice, type the text `java.exe -jar myjar.jar`, replacing `myjar.jar` with the fully qualified name of your jar file. *(...cannot say more in a single comment...)* – Andreas Feb 28 '18 at 05:47