Archive: Writing to log file using ExecWait


Writing to log file using ExecWait
Hello

I am trying to use ExecWait to redirect java output (error and system.out) to a log file. Using the example given in other threads i came up with the sample below. But the log file is still empty infact the java program was not executed.

ExpandEnvStrings $0 %COMSPEC%
ExecWait '"$0" /C "$INSTDIR\JRE\Win32\bin\javaw.exe" -Djava.endorsed.dirs="$INSTDIR\Tomcat\common\endorsed" -cp Test "Hello World" > "$INSTDIR\installer.log"' $5

Note:
However trying this (without all the ExpandEnvStrings) execute the java program.

ExecWait '"$0" /C "$INSTDIR\JRE\Win32\bin\javaw.exe" -Djava.endorsed.dirs="$INSTDIR\Tomcat\common\endorsed" -cp Test "Hello World"' $5

I did not use nsExec because it does not work with the special build ( build that uses NSIS compiler maximum string length of 8192 bytes)


ExecDos allocates strings according to NSIS build used. It's last parameter is stdout file. I tested this


ExecDos::exec 'javaw.exe -Djava.endorsed.dirs="$INSTDIR\Tomcat\common\endorsed" -cp Test "Hello World"' "" "$EXEDIR\installer.log"
Pop $5

Result - exit(2) and NOT empry installer.log:
Error opening registry key 'Software\JavaSoft\Java Runtime Environment'
Error: could not find java.dll
Error: could not find Java 2 Runtime Environment.

I have to use ExecWait because mine is a console application while prompts user for the password. How do I redirect output in this case to a logfile?