Skip to content
⌘ NSIS Forum Archive

ExecWait fails when used with Defines

4 posts

cupid062985#

ExecWait fails when used with Defines

Hi Guys,

I am still new with NSIS. I would like to run a JAR File. I placed it in an Installer Section to run this.

DEFINES:

!define PRODUCTPROFILE "setup\lib\myfile.xml"
!define LKMCSETUPTOOL "setup\lib\myjar.jar"
!define LKMCINTEG "my.class.sample.Main"
!define JAVAWEXE "jre\bin\javaw.exe"
SECTION:

Section "-Setup" SEC06
SetOutPath "$APPDATA\setup"
File /r "..\data\tools\setuptool"
File "..\data\myfile.xml"

; Integrate License
ExecWait '"$INSTDIR\${JAVAWEXE}" -Dwinsysdir="C:\Windows\System32" -cp "$APPDATA\${LKMCSETUPTOOL}" "${LKMCINTEG}" "$APPDATA\${PRODUCTPROFILE}"'
Delete /REBOOTOK "$APPDATA\${PRODUCTPROFILE}"

SetFileAttributes "$APPDATA\setup" HIDDEN
SectionEnd
I noticed the following:
1. If I execute the code EXECWAIT in the onInit with different Define Values, it works.
2. If I hard code the Path, it also works.

Hope someone can help me. Thanks! 🙂
Afrow UK#
The values of defines are substituted at compile time so using them will not effect how an instruction behaves unless your defined values are incorrect for their desired purpose.

My first guess would be that it is failing because you are using a relative path for LKMCINTEG and yet your working directory is $APPDATA\setup (SetOutPath sets the current working directory).

Stu
Anders#
You should try running Process Monitor, I'm guessing the process is started and fails early for some reason...