Skip to content
⌘ NSIS Forum Archive

Executing a java JAR file after NSIS installation is complete

11 posts

daibatzu#

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.
daibatzu#
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#
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#
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#
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#
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#
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
viswa#
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
Anders#
Originally Posted by viswa View Post
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.
What do you mean by already running? What do you mean by not working? Error messages?