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.
Executing a java JAR file after NSIS installation is complete
11 posts
You forgot to quote the path to javaw.exe. It might contain spaces, so it must be quoted.
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.
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
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
Yes, but the file Konfigurator.jar is in $INSTDIR\bin. How do I locate it and run, even if I find javaw.exe. thanks.
Originally posted by daibatzuExec 'javaw.exe -jar "$INSTDIR\bin\Konfigurator.jar"'
Yes, but the file Konfigurator.jar is in $INSTDIR\bin. How do I locate it and run, even if I find javaw.exe. thanks.
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.
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
Thanks a lot hooklee, it works perfectly now
issue with executing javaw.exe
Hi ,
If we give full path of javaw.exe then it works fine.
Ex : if i install jre of 1.8.0_49 at the time of install this path will be set.
and it works fine.
When we update the java to 1.8.0_51 already running java application will not work.
How can we solve this issue.
Regards
Viswa
Hi ,
If we give full path of javaw.exe then it works fine.
Ex : if i install jre of 1.8.0_49 at the time of install this path will be set.
and it works fine.
When we update the java to 1.8.0_51 already running java application will not work.
How can we solve this issue.
Regards
Viswa
What do you mean by already running? What do you mean by not working? Error messages?Originally Posted by viswa View PostIf we give full path of javaw.exe then it works fine.
Ex : if i install jre of 1.8.0_49 at the time of install this path will be set.
and it works fine.
When we update the java to 1.8.0_51 already running java application will not work.