Windows 7 UAC Prompt for Jars

Cardinal System

Honorable Member
Joined
Jan 24, 2016
Location
New Hampshire
Is it possible to show a UAC prompt for a Java jar file? I am aware that one can edit an executable's manifest to require an elevated process, but there seems to be no way to do so with a Jar file. I do not want to edit javaw.exe's manifest.

Is there a specific file that that can take file path arguments to show a UAC prompt? Or do I have to learn powershell? Or is there a better solution?
 
Can't do it with straight up java. You'll either want to use a script (powershell or vb script) or create a wrapper executable with a manifest requiring elevation.
 
Running it from powershell would simply be

Start-Process -FilePath "C:\path\to\java.exe" -ArguementList "-jar path\to\file.jar" -Verb "RunAs"
 
Running it from powershell would simply be

Start-Process -FilePath "C:\path\to\java.exe" -ArguementList "-jar path\to\file.jar" -Verb "RunAs"
I've never used powershell, so I'm not sure how to resolve this error:
Capture.PNG
 
Single quote the path
"-jar 'C:\Users\Firstname Lastname\Desktop\Java Program.jar'"
 
Back
Top Bottom