I am developing a grammar with ANTLRWorks on Windows 7. The ANTLRWorks debugger doesn't start unless ANTLRWorks has Administrator privileges. ANTLRWorks is delivered as one Java .jar which starts by a doubleclick on the file.
Question: How can I assure that the .jar file runs with Administrator Privileges ?
Navigate to your Java installation folder, go inside the /bin/ folder, right-click on Java.exe and set it to “Run as Administrator”.
Run your command prompt in administrator mode. To more specific: Locate the %windir%\system32\cmd.exe file. Right click and run as administrator privilege.
Right-click your JAR file and choose Open With > Java(TM) Platform SE Binary. Tip: If you don't see that option in the “Open With” menu, then click “Choose Another App” and you'll see the option. Your JAR file will launch and you'll be able to interact with it. And that's all there is to it.
You can run cmd under Administrator and launch ANTRLWorks using java -jar command.
You may want to have a look at Johannes Passing's Opensource Tool Elevate.exe There are many possibilities of using it. You can make a wrapper jar or simply use a batch file with something like:
Elevate.exe javaw.exe -jar path-to-your-jar-file
and this will launch UAC prompt, when allowed will permit the jar to have elevated privileges.
if you do not like batch files, then you can write a simple wrapper class to do so. Normally i make another jar file as a launcher for the jar which requires admin access, and in the launcher file, simply execute external process with the above command, and this way my jar has admin privileges.
first, download this program from here http://code.kliu.org/misc/elevate/
then copy the "elevate.exe" file to the folder where your .jar file is.
Make, a .bat file as "elevate java -jar YourJARFile.jar". Run the .bat file.Simple as that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With