Archive: Dealing with Shortcuts and Java Upgrades


Dealing with Shortcuts and Java Upgrades
I am curious if anyone has a solution for this scenario, or an alternative way of creating java launch shortcuts

. During our install we verify a minimum JRE version is installed
. We grab the path to that JRE
. We place that path in a desktop launch shortcut (eg "$JreHome\bin\javaw.exe foo.jar")

My concern is that the uninstall, or upgrade, of the JRE will potentially break this, or not allow the user to make use of an upgrade (if they place it in a different directory).

Here is how we create the shortcut:
CreateShortcut "$INSTDIR\${APPLICATION_NAME}.lnk" "$JreHome\bin\javaw.exe" \
"-jar foo.jar ." "$INSTDIR\some.ico"


How about having your shortcut point to a silent C or NSIS executable which does the execution. If you go with NSIS, something like this will do:

OutFile LaunchFoo.exe
SilentInstall silent
Icon some.ico
SetCompress off

Section
; Get Java install path here.
Exec `"$R0\bin\javaw.exe" -jar foo.jar`
SectionEnd
Stu