Archive: CreateShortcut prepends system32


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


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.


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...

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

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


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.