Archive: javaws and desktop shortcut creation

javaws and desktop shortcut creation
A little background first. A colleague of mine used NSIS a few years ago to create an installer for our Java application. It has been working but now we want to move to Java 7 which requires minor tweaking to the nsi script.

I took the existing script he wrote and changed the name of the java file that is running and the associated arguments for running, namely I changed this:

ExecWait "$TEMP\j2re\jre-6u13-windows-i586-p-iftw.exe /passive ADDLOCAL=jrecore STATIC=1"

to this:

ExecWait "$TEMP\j2re\jre-7u25-windows-i586.exe /s"

At the very end of the script it runs a single javaws line that should copy shortcuts to the desktop (where $4 is the jnlp file location):

ExecWait "javaws -wait -shortcut -import -system $4"

The previous installer we created with NSIS would prompt the user at the end to create shortcuts but the new installer is just failing.

At this point I have three things to look at, namely the javaws command, the jnlp file we are using and the nsi script.

Can anyone help me narrow down my problem?

I would say all those exec calls are wrong, please use:

ExecWait '"c:\full\path\to\app.exe" /param1 "par am2" /param3'

I did manage to get the shortcuts to install by commented this out but I am noticing some inconsistencies in the Java cache viewer:

SetShellVarContext all

;these files are required for system-wide install of java web start applications
CreateDirectory "$WINDIR\Sun\Java\Deployment"
SetOutPath "$WINDIR\Sun\Java\Deployment"
File deployment.config

Thanks Anders, I will try that out as well

So it turns out my problem was that the previous script was not scrubbing the javaws cache files well enough so I added these lines:

;for windows 7
RMDir /r /REBOOTOK "$PROFILE\AppData\LocalLow\Sun\Java\Deployment\cache"
RMDir /r /REBOOTOK "$PROFILE\AppData\LocalLow\Sun\Java\Deployment\SystemCache"

;for windows xp
RMDir /r /REBOOTOK "$LOCALAPPDATA\Sun\Java\Deployment\cache"
RMDir /r /REBOOTOK "$LOCALAPPDATA\Sun\Java\Deployment\SystemCache"