Hi,
I am writing a NSIS installer for my app and there's a line in my script using ExecWait to execute a runnable jar file with arguments:
ExecWait 'javaw.exe -jar "<path to jar>" "arg1" "arg2" ... "arg6"' $var
After this line I check the value of $var to do other things. This jar file, when it's executed it will generate a log file in my installation dir. I tried this in Windows 7 64-bit with Java 1.7 and it worked perfectly. I can get the value of the exit code $var as well as the log file.
However, when I tried the same installer in Windows Server 2012 R2 64-bit with the same Java 1.7, I got an empty value from $var and there was no log file generated. At first I thought there were problems with ExecWait like I had created some grandchildren processes which wouldn't be waited. However since there was no log file, the jar was not executed at all.
I tried to run the jar file manually in command line with all kinds of arguments (correct and incorrect) and it was executed correctly and the log was generated.
Hence I suspect this ExecWait was skipped in Windows Server 12 R2. I have another ExecWait before that, which is something like:
ExecWait "<a batch file>"
And it ran well on both Windows. I am thinking of some problems relating to nested quotation here. However Im pretty sure I got the recommended syntax here.
This is my first installer using NSIS so I would be really grateful if someone can give me a pointer.
Thanks a lot.
ExecWait is skipped when executing jar file in windows server 2012 r2
3 posts
ExecWait is never "skipped", most likely the internal call to CreateProcess inside ExecWait failed.
Try using the full path to javaw.exe.
You can use Process Monitor to figure out why it fails to start a new process...
Try using the full path to javaw.exe.
You can use Process Monitor to figure out why it fails to start a new process...
Full path of Java does the trick. Thanks a lot. I'll spend more time understanding this.