Forum Controls
Spotlight Features

The Rich Engineering Heritage Behind Dependency Injection

Andrew McVeigh takes us on a tour of the rich heritage behind dependency injection, what it represents, and tells us why its here to stay.

NetBeans 6: Matisse Updates

NetBeans 6 delivers great updates to the Matisse GUI builder. Spend a few minutes with Roman Strobl and get an expert briefing on what's new and what has changed.

Introduction to Groovy Part 3

In this, the third and final installation of Andres' Introduction to Groovy series, you learn about how Groovy handles variable numbers of arguments, named parameters, currying, and more about Groovy operators. Including, some new operators.

Easier Custom Components with Swing Fuse

Swing Fuse (actually just Fuse), is a framework designed to make it easier to create your own custom desktop components. In this article, Daniel Spiewak shows you how to get started and provides sample source code you can download.

Benchmark Analysis: Guice vs Spring

Willam Louth shows how he uses JXInsight Probes to investigate probable performance issues with code bases that he is not familiar with. He also highlights possible pitfalls in creating a benchmark, as well as in the analysis of results.
Replies: 3 - Pages: 1  
Threads: [ Previous | Next ]
  Click to reply to this thread Reply

Building Native Windows Installers with IzPack Native Launcher

At 2:23 PM on Feb 23, 2005, Matthew Schmidt wrote:

Julien Ponge, author of IzPack, describes how you can easily create a native installer that handles the missing JRE problem. Read on for how easy it can be!

Read the full article now!
1 . At 6:50 AM on Feb 28, 2005, Cameron Zemek wrote:
  Click to reply to this thread Reply

Re: Building Native Windows Installers with IzPack Native Launcher

Using NSIS (see http://nsis.sourceforge.net/) I have the following scripts:
Program Launcher
; Program Launcher

!define APPNAME "MyApp"
!define CLASSPATH "lib\somelib.jar;lib\someotherlib.jar"
!define MAINCLASS "app.StartUp"

; Uncomment the next line to specify an icon for the EXE
Icon "myApp.ico"

;--------------------------
Name "${APPNAME}"
Caption "${APPNAME}"
OutFile "installDir\${APPNAME}.exe"

SilentInstall silent
ShowInstDetails nevershow
AutoCloseWindow true

Section ""
SetOutPath $EXEDIR
Exec '$EXEDIR\jre\bin\${APPNAME}.exe -classpath ${CLASSPATH} ${MAINCLASS}'
SectionEnd

Installer script
!define PRODUCT_NAME "MyProduct"
!define COMPANY_NAME "MyCompany"

; ----------------------------

Name "${PRODUCT_NAME}"
OutFile "Install_${PRODUCT_NAME}.exe"

; Some default compiler settings (uncomment and change at will):
SetCompressor lzma
SetCompress auto ; (can be off or force)
; SetDatablockOptimize on ; (can be off)
CRCCheck on ; (can be off)
; AutoCloseWindow false ; (can be true for the window go away automatically at end)
ShowInstDetails hide ; (can be show to have them shown, or nevershow to disable)
; SetDateSave off ; (can be on to have files restored to their orginal date)

InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${COMPANY_NAME}\${PRODUCT_NAME}" ""
;DirShow hide ; make this show to let the user change it)

Section "" ; (default section)
SetOutPath "$INSTDIR"

; add files / whatever that need to be installed here.
File /r "installDir\*"

; allow write access to database folder
AccessControl::GrantOnFile "$INSTDIR\resources\db" "BUILTIN\USERS" "FullAccess"

; create desktop shortcut
CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" ""

; create start-menu items
CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" "" "$INSTDIR\${PRODUCT_NAME}.exe" 0

; write uninstall registry keys
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\${COMPANY_NAME}\${PRODUCT_NAME}" "" "$INSTDIR"
WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME} (remove only)"
WriteRegStr HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
WriteRegDWORD HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "NoModify" "1"
WriteRegDWORD HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "NoRepair" "1"

; write out uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"

SectionEnd ; end of default section

; begin uninstall settings/section
UninstallText "This will uninstall ${PRODUCT_NAME} from your system"

Section Uninstall
; Delete installation files
RMDir /r "$INSTDIR"

; Delete Desktop Shortcut
Delete "$DESKTOP\${PRODUCT_NAME}.lnk"

; Delete Start Menu Shortcuts
Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk"
Delete "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk"
RMDir "$SMPROGRAMS\${PRODUCT_NAME}"

; Delete uninstall registry keys
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${COMPANY_NAME}\${PRODUCT_NAME}"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"

; Delete Uninstaller
Delete "$INSTDIR\Uninstall.exe"
SectionEnd ; end of uninstall section

; eof

Notes
In the launcher script ${APPNAME}.exe is a copy of either java.exe or javaw.exe . It is so that in the process list you get ${APPNAME}.exe instead of java.exe or javaw.exe .

installDir includes the bundled JRE, jar files, and other resource files. As per the README.txt of the JRE remove the optional files that you don't use from the bundled JRE.

Using these scripts I have gotten the installer down under 10MB with Sun's JRE 1.4.2 included. The resulting installer is very simple to use, no need for the end-user to know about Java or installation of JRE. The disadvantage is the JRE is not installed system wide.
2 . At 12:17 AM on Oct 29, 2005, Marlon Alvarado wrote:
  Click to reply to this thread Reply

Re: Building Native Windows Installers with IzPack Native Launcher

Hi Julian:

Thanks for your article.
I followed the instructions and in the end i get the same output file you do an .exe.

However when I tried to run the .exe i get an 7-zip dialog box asking me if I want to unpack the files.
This is, I don't get the 'izpack' installation dialog box.

Any idea what it could have gone wrong.

Best Regards,
Marlon
3 . At 5:10 PM on Mar 20, 2006, Scott Plante wrote:
  Click to reply to this thread Reply

Re: Building Native Windows Installers with IzPack Native Launcher

This links to a page I created that explains a similar method using launch4j and Orangevolt ANT tasks to create a native launcher for Windows that includes and installs a JRE, with the build occuring on Linux. --Scott Plante

http://openfacts.berlios.de/index-en.phtml?title=IzPack/JRE-Install

thread.rss_message