2013-03-19 3 views
0

아래 스크립트를 사용하여 만든 모든 설정이 하나의 폴더에 복사됩니다. Calculator 폴더에 lib 폴더를 만들고 모든 jar 파일을 lib 폴더에 복사하려고합니다. 응용 프로그램은 classpath에서 지정한 jar 파일을 찾을 수 있습니다. NSIS를 사용하여 환경 변수를 설정하는 방법은 무엇입니까? 내가 NSIS에 처음 온 것처럼 도와주세요.nsis를 사용하여 jar 파일을 새 폴더에 복사

File /r "G:\IMS\dist\*" 

이 디렉토리 구조를 유지하며, 항아리는 lib 하위 디렉토리에 설치됩니다

; Name of our application 
Name "Calculator" 

; The file to write 
OutFile "Calculatorv1.0_Setup.exe" 

; Set the default Installation Directory 
InstallDir "$PROGRAMFILES\Calculator" 

; Set the text which prompts the user to enter the installation directory 
DirText "Please choose a directory to which you'd like to install this application." 

; ---------------------------------------------------------------------------------- 
; *************************** SECTION FOR INSTALLING ******************************* 
; ---------------------------------------------------------------------------------- 

Section "" ; A "useful" name is not needed as we are not installing separate components 

; Set output path to the installation directory. Also sets the working 
; directory for shortcuts 
SetOutPath $INSTDIR\ 

File G:\IMS\dist\Calculator.exe 
File G:\IMS\dist\lib\*.jar 

File a.nsi 

WriteUninstaller $INSTDIR\Uninstall.exe 

; ///////////////// CREATE SHORT CUTS ////////////////////////////////////// 

CreateDirectory "$SMPROGRAMS\Calculator" 


CreateShortCut "$SMPROGRAMS\Calculator\Run Calculator.lnk" "$SYSDIR\javaw.exe" "NSISExampleApplication1" 


CreateShortCut "$SMPROGRAMS\Calculator\Uninstall Example Application 1.lnk" "$INSTDIR\Uninstall.exe" 

; ///////////////// END CREATING SHORTCUTS ////////////////////////////////// 

; //////// CREATE REGISTRY KEYS FOR ADD/REMOVE PROGRAMS IN CONTROL PANEL ///////// 

WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Calculator" "DisplayName"\ 
"Calculator (remove only)" 

WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Calculator" "UninstallString" \ 
"$INSTDIR\Uninstall.exe" 

; //////////////////////// END CREATING REGISTRY KEYS //////////////////////////// 

MessageBox MB_OK "Installation was successful." 

SectionEnd 

; ---------------------------------------------------------------------------------- 
; ************************** SECTION FOR UNINSTALLING ****************************** 
; ---------------------------------------------------------------------------------- 

Section "Uninstall" 
; remove all the files and folders 
Delete $INSTDIR\Uninstall.exe ; delete self 
Delete $INSTDIR\Calculator.exe 
Delete $INSTDIR\a.nsi 

RMDir $INSTDIR 

; now remove all the startmenu links 
Delete "$SMPROGRAMS\Calculator\Run Calculator.lnk" 
Delete "$SMPROGRAMS\Calculator\Uninstall Calculator.lnk" 
RMDIR "$SMPROGRAMS\Calculator" 

; Now delete registry keys 
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Calculator" 
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Calculator" 
SectionEnd 
+0

앱이있는 경우 데스크톱 앱입니다. (GUI가있는) 다음 [Java Web Start] (http://stackoverflow.com/tags/java-web-start/info) can 1) jars를 올바른 위치에 놓습니다. 2) 필요에 따라 자동 업데이트하십시오. 3) 특성 및 환경 변수를 설정하십시오. - 계산기가 환경 변수를 설정해야하는 이유는 무엇입니까? –

답변

0

당신은 /r 플래그를 재귀 적으로 파일을 추가하여 해당 할 수 있습니다.

+0

'/ r' 플래그의 특수한 동작에주의하십시오 : 파일을 얻는 패턴 ('.pl'과 같은)을 주면이 예제에서'.IMS' 디렉토리의 서브 디렉토리에서 다른 .pl 파일을 얻을 수 있습니다 . 그것은 설명서에 설명되어 있습니다. – Seki

관련 문제