I know there are tons of questions here asking the same, but in any of those ain't found the answer that I want, that is a specific way for doing this.
I know that (correct me if I'm wrong):
- For doing this, i'll need to interact with Windows UAC mechanism.
- This can't be done with pure Java code, it needs the help of a Batch file, or VBS script.
- A Java running process can't be elevated to get admin privilegs without needed restart the application.
- Elevate a
.jar
file will elevate also the JVM and all other process that depends of JVM, with the security concern this imply.
I don't want to restart any application, my goal is that the Java application (.jar
file) starts from the begining with admin privilegs. If for get that, the users will have to click in some UAC windows, ok, don't care.
So, my question (that I can't get and specific answer reading other post asking almost the same thing). How can I do that?, What files I need to create, and with what content? (.bat
or .vbs
), Can I put those files inside my .jar
file?, What Java code I'll need to implement in my app?
Please, be the most specific as possible with the solution. Answers in other post are, or too vague (talk about "possible" solutions, but don't mention a specific and complete one), or explain too much and don't give a specific way or code.