Skip to content
⌘ NSIS Forum Archive

fileassoc to call installed Java program

6 posts

tofu262#

fileassoc to call installed Java program

Hi,

I am having trouble coding up the nsi script to have the
"jkw" file type be recognized by windows and automatically launch my installed java program called DTDD with the file name as a parameter. Please help.

fileassoc link

I am using the fileassoc.nsh macro to help create the file association, this is what i have now:

!insertmacro APP_ASSOCIATE "jkw" "DTDD.jkw" "'$SYSDIR\java.exe -Xmx1024m -cp $INSTDIR\v22\classes DTDD',0" \
"Open with DTDD" "'$SYSDIR\java.exe -Xmx1024m -cp $INSTDIR\v22\classes DTDD -projFile' $\"%1$\"" ""

Does the %1 read the file I clicked? I am not sure what each of the parameters represent. Any ideas?

Thanks,
J
kichik#
%1 is the file you clicked.

The icon seems dodgy. You've used the path to java with all the parameters for the icon.

You've also left the most important parameter - COMMAND, empty and put the real command in the COMMANDTEXT which should be something like "Run" or "Open".
tofu262#
So the paramters are:

!insertmacro APP_ASSOCIATE "file_extension" "DTDD.jkw" "path to Icon" "description string" "Run/Open" "Command"

I have tried the following:
!insertmacro APP_ASSOCIATE "jkw" "DTDD.jkw" "$INSTDIR\logo.ico"
"Open with DTDD" "Open" "$SYSDIR\java.exe -Xmx1024m -cp $INSTDIR\v22\classes DTDD"

I have installed the program in c:\program files\DTDD
I am receiving NoClassDefFoundError: Files\DTDD

What am I still missing?
Thanks.
Afrow UK#
So you've tried like this:

!insertmacro APP_ASSOCIATE "jkw" "DTDD.jkw" "$INSTDIR\logo.ico" 
"Open with DTDD" "Open" `$SYSDIR\java.exe -Xmx1024m -cp "$INSTDIR\v22\classes" DTDD`
Stu