3 回答

TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超5個(gè)贊
最簡(jiǎn)單的方法是使用包裝器啟動(dòng)JVM,然后提升包裝器。我使用一個(gè)簡(jiǎn)單的NSIS安裝程序腳本和UAC插件來(lái)完成這個(gè)任務(wù):
; Java Launcher
;--------------
; You want to change the below lines
Name "my program"
Caption "my program Launcher"
Icon "iconfile.ico"
OutFile "java launcher.exe"
; param below can be user, admin
RequestExecutionLevel admin
!include UAC.nsh
SilentInstall silent
AutoCloseWindow true
ShowInstDetails show
Section ""
; command to execute
StrCpy $0 'javaw -jar myjarfile'
SetOutPath $EXEDIR
Exec $0
SectionEnd
添加回答
舉報(bào)