Created
January 8, 2013 01:51
-
-
Save anonymous/4480388 to your computer and use it in GitHub Desktop.
Javaアプリケーション上でUACによる特権昇格が必要な処理を行う方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Javaアプリケーション上でUACによる特権昇格が必要な処理を行う場合、 | |
1) 特権が必要な処理を別のjarに切りだし、 | |
2) launch4jなどで | |
"requestedExecutionLevel = highestAvailable" | |
なマニフェストをもつexeファイルとする。 | |
3) アプリケーション側より、それを Desktop.open()メソッドで呼び出す. | |
※ UAC昇格にはShellExecute系APIによるexeの呼び出しが必要なため。 | |
※ CreateProcess系では不可 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<launch4jConfig> | |
<dontWrapJar>false</dontWrapJar> | |
<headerType>gui</headerType> | |
<jar>dist\LicenseManager.jar</jar> | |
<outfile>LicenseManager.exe</outfile> | |
<errTitle></errTitle> | |
<cmdLine></cmdLine> | |
<chdir></chdir> | |
<priority>normal</priority> | |
<downloadUrl>http://java.com/download</downloadUrl> | |
<supportUrl></supportUrl> | |
<customProcName>true</customProcName> | |
<stayAlive>false</stayAlive> | |
<manifest>LicenseManager.manifest</manifest> | |
<icon></icon> | |
<classPath> | |
<mainClass>example.LicenseManagerApp</mainClass> | |
<cp>lib/LicenseLib.jar</cp> | |
</classPath> | |
<jre> | |
<path></path> | |
<minVersion>1.6.0</minVersion> | |
<maxVersion></maxVersion> | |
<jdkPreference>preferJre</jdkPreference> | |
<initialHeapSize>128</initialHeapSize> | |
<maxHeapSize>128</maxHeapSize> | |
</jre> | |
<versionInfo> | |
<fileVersion>1.0.0.0</fileVersion> | |
<txtFileVersion>LicenseManager</txtFileVersion> | |
<fileDescription>EXAMPLE LICENSE MANAGER</fileDescription> | |
<copyright>seraphyware</copyright> | |
<productVersion>1.0.0.0</productVersion> | |
<txtProductVersion>LicenseManager</txtProductVersion> | |
<productName>LICENSE MANAGER</productName> | |
<companyName>seraphyware</companyName> | |
<internalName>LicenseManager</internalName> | |
<originalFilename>LicenseManager.exe</originalFilename> | |
</versionInfo> | |
</launch4jConfig> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> | |
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> | |
<security> | |
<requestedPrivileges> | |
<requestedExecutionLevel level="highestAvailable" | |
uiAccess="False" /> | |
</requestedPrivileges> | |
</security> | |
</trustInfo> | |
</assembly> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment