dickbalaska
22nd February 2009 19:21 UTC
CreateShortcut prepends system32
Hi ho,
I am trying to create a shortcut to launch java and point it at my jar.
CreateShortCut "$SMPROGRAMS\BuckoFIBS\BuckoFIBS.lnk" 'java' "$INSTDIR\[JARFILE]" "" 0
This ends up pointing at c:\windows\system32\java.exe where i have no java installed.
In the FAQ, http://nsis.sourceforge.net/I_am_hav...CreateShortcut
i end up with c:\windows\system32\notepad.exe.
How do i keep nsis from prepending or altering the target file?
thanks
dik
demiller9
22nd February 2009 22:35 UTC
Add the correct path yourself. You have just 'java', but you can't do that. Shortcuts require a complete path, you can't even do relative paths when you create a shortcut with the Windows UI.
LoRd_MuldeR
22nd February 2009 23:36 UTC
Maybe like this:
StrCpy $0 'java -jar "$INSTDIR\foobar.jar"'
CreateShortCut "$SMPROGRAMS\BuckoFIBS.lnk" "$SYSDIR\cmd.exe" '/c "$0"' "" 0
This way the commandline interpreter (cmd.exe) will execute the command.
As long as "java.exe" can be found in %PATH%, this should work...
dickbalaska
22nd February 2009 23:55 UTC
Originally posted by demiller9
Add the correct path yourself. You have just 'java', but you can't do that. Shortcuts require a complete path, you can't even do relative paths when you create a shortcut with the Windows UI.
I am fresh out of win2k boxes, but this works swell on XP-Pro and Vista (32|64).
I would prefer doing a .jar like this because then i don't care what version of java the user has; and when he upgrades his java and suddenly c:\program files\sun\java-6u1.5 is gone and replaced with c:\sun\appserver\jre, i don't care; all i care about is which java is in the path.
dik
Anders
23rd February 2009 00:02 UTC
there are several java launchers projects on sf.net, why not use one of those, then you don't have to hope that java[c].exe is in the path
dickbalaska
25th February 2009 08:32 UTC
I ended up doing the "detect where java is" thing, modeled after http://nsis.sourceforge.net/Get_full_Java_version .
The sf java launchers i saw were all 'conceptual' for 5 years now; or one that was complete, gave no samples or instructions.