daibatzu
3rd May 2005 17:21 UTC
Executing a java JAR file after NSIS installation is complete
Hello, I have this slight problem. I have written an installer, which copies a JAR file called Konfigurator.jar to $INSTDIR/bin., NOw, what I want to do is to run this JAR file after installation is complete.
So I added the command:
Exec "$INSTDIR\bin\javaw.exe -jar Konfigurator.jar"
But it doesn't work. Please can anyone give me a tip on how to run the JAR file using javaw -jar, Please anyhelp is appreciated. This is also urgent. Thanks.
kichik
3rd May 2005 20:36 UTC
You forgot to quote the path to javaw.exe. It might contain spaces, so it must be quoted.
daibatzu
4th May 2005 17:28 UTC
Please it doesn't work. Can you please tell me how to run a JAR file located in a specified folder using the NSIS Exec command or any other command. The system on which the jar file is to be run already has a JRE installed. Thank you very much.
hooklee
4th May 2005 19:03 UTC
You should locate javaw.exe at first. See the following code:
SearchPath $0 "javaw.exe"
StrCmp $0 "" 0 OK1 ; if javaw.exe in PATH
ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
ReadRegStr $0 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$1" "JavaHome"
StrCmp $0 "" Error OK2
OK1:
StrCmp $0 "javaw.exe -jar Konfigurator.jar"
Goto OK
OK2:
StrCmp $0 '"$0\javaw.exe" -jar Konfigurator.jar'
Goto OK
Error:
MessageBox MB_OK "javaw.exe does not exist!"
Abort
OK:
Exec $0
daibatzu
5th May 2005 16:32 UTC
Yes, but the file Konfigurator.jar is in $INSTDIR\bin. How do I locate it and run, even if I find javaw.exe. thanks.
hooklee
5th May 2005 17:13 UTC
Originally posted by daibatzu
Yes, but the file Konfigurator.jar is in $INSTDIR\bin. How do I locate it and run, even if I find javaw.exe. thanks.
Exec 'javaw.exe -jar "$INSTDIR\bin\Konfigurator.jar"'
daibatzu
5th May 2005 18:26 UTC
This is the exact command I have used and yet it does not work. I don't have a clue why not. Anyway, thanks for the help.
hooklee
5th May 2005 19:12 UTC
SearchPath $0 "javaw.exe"
StrCmp $0 "" 0 OK1 ; if javaw.exe in PATH
ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
ReadRegStr $0 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$1" "JavaHome"
StrCmp $0 "" Error OK2
OK1:
StrCmp $0 'javaw.exe -jar "$INSTDIR\bin\Konfigurator.jar"'
Goto OK
OK2:
StrCmp $0 '"$0\javaw.exe" -jar "$INSTDIR\bin\Konfigurator.jar"'
Goto OK
Error:
MessageBox MB_OK "javaw.exe does not exist!"
Abort
OK:
Exec $0
daibatzu
9th May 2005 09:19 UTC
Thanks a lot hooklee, it works perfectly now