पॉक्सू के जवाब पर अनुवर्ती करने के लिए, मैं लॉन्च 4j और एनएसआईएस का उपयोग अपनी परियोजना पर कर रहा हूं और सोचा कि यह दिखाने में मददगार होगा कि मैं उनका उपयोग कैसे कर रहा हूं। विंडोज़ के लिए मैं क्या कर रहा हूं। बीटीडब्ल्यू, मैं मैक के लिए .app और .dmg बना रहा हूं, लेकिन यह पता नहीं लगाया गया है कि अभी तक लिनक्स के लिए क्या करना है।
लॉन्च 4j और एनएसआईएस की परियोजना प्रतियां
मेरी प्रोजेक्ट में मेरे पास "विक्रेता" निर्देशिका है और इसके नीचे मेरे पास "launch4j" और "nsis" की निर्देशिका है। प्रत्येक के भीतर प्रत्येक एप्लिकेशन के लिए इंस्टॉल की एक प्रति है। मुझे दूसरों को दोनों उत्पादों को स्थापित करने के लिए मजबूर करने और प्रत्येक को इंगित करने के लिए किसी प्रकार का पर्यावरण चर स्थापित करने के बजाय प्रोजेक्ट में स्थानीय प्रतिलिपि बनाना आसान लगता है।
स्क्रिप्ट फ़ाइलें
I also have a "scripts" directory in my project that holds various configuration/स्क्रिप्ट फ़ाइलें for my project. First there is the launch4j.xml file:
true
gui
rpgam.jar
rpgam.exe
.
normal
http://www.rpgaudiomixer.com/
false
false
1.5.0
preferJre
..\images\splash.bmp
true
60
true
और फिर एनएसआईएस स्क्रिप्ट rpgam-setup.nsis है। फ़ाइल नाम देने में मदद के लिए यह एक संस्करण तर्क ले सकता है।
; The name of the installer
Name "RPG Audio Mixer"
!ifndef VERSION
!define VERSION A.B.C
!endif
; The file to write
outfile "..\dist\installers\windows\rpgam-${VERSION}.exe"
; The default installation directory
InstallDir "$PROGRAMFILES\RPG Audio Mixer"
; Registry key to check for directory (so if you install again, it will
; overwrite the old one automatically)
InstallDirRegKey HKLM "Software\RPG_Audio_Mixer" "Install_Dir"
# create a default section.
section "RPG Audio Mixer"
SectionIn RO
; Set output path to the installation directory.
SetOutPath $INSTDIR
File /r "..\dist\layout\windows\"
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\RPG_Audio_Mixer "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RPGAudioMixer" "DisplayName" "RPG Audio Mixer"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RPGAudioMixer" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RPGAudioMixer" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RPGAudioMixer" "NoRepair" 1
WriteUninstaller "uninstall.exe"
; read the value from the registry into the $0 register
;readRegStr $0 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" CurrentVersion
; print the results in a popup message box
;messageBox MB_OK "version: $0"
sectionEnd
Section "Start Menu Shortcuts"
CreateDirectory "$SMPROGRAMS\RPG Audio Mixer"
CreateShortCut "$SMPROGRAMS\RPG Audio Mixer\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\RPG AUdio Mixer\RPG Audio Mixer.lnk" "$INSTDIR\rpgam.exe" "" "$INSTDIR\rpgam.exe" 0
SectionEnd
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RPGAudioMixer"
DeleteRegKey HKLM SOFTWARE\RPG_Audio_Mixer
; Remove files and uninstaller
Delete $INSTDIR\rpgam.exe
Delete $INSTDIR\uninstall.exe
; Remove shortcuts, if any
Delete "$SMPROGRAMS\RPG Audio Mixer\*.*"
; Remove directories used
RMDir "$SMPROGRAMS\RPG Audio Mixer"
RMDir "$INSTDIR"
SectionEnd
चींटी एकीकरण
उपरोक्त को संभालने के लिए मेरे एंटी buildfile (build.xml) में मेरे कुछ लक्ष्य हैं। लॉन्च 4j के चींटी कार्यों को आयात करने के लिए पहले मैं टेल एंट:
मेरे पास रैपर निष्पादन योग्य बनाने के लिए एक सरल लक्ष्य है:
और इंस्टॉलर बनाने के लिए एक और लक्ष्य:
<!-- Lay out files needed for building the installer -->
<!-- Build the installer using NSIS -->
इसका शीर्ष भाग इंस्टॉलर को अस्थायी स्थान पर आवश्यक फ़ाइलों की प्रतिलिपि बनाता है और दूसरा आधा उस स्क्रिप्ट को निष्पादित करता है जो इंस्टॉलर बनाने के लिए इसका उपयोग करता है।