Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   CreateShortcut prepends system32 (http://forums.winamp.com/showthread.php?t=303387)

dickbalaska 22nd February 2009 18:21

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 21:35

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 22:36

Maybe like this:

code:
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 22:55

Quote:

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 22nd February 2009 23:02

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 07:32

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.


All times are GMT. The time now is 04:27.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.