jacknad
jacknad

Reputation: 13739

Why is NSIS check for JRE broken?

Why does this script try to install the jre when it doesn't need to? I verified that C:\Windows\System32\java.exe does in fact exist, but this script doesn't see it. The script is targeting XP, Vista, 32 bit, and 64 bit. The script !includes x64.nsh. The reason for the first ElseIf is that the javaw.exe is sometimes installed in C:\Windows\System32\ on 64 bit systems. Is the logic bogus? If so, how? Is the use of C:\Windows\System32\javaw.exe improper?

${If} ${FileExists} `$SYSDIR\javaw.exe`
    ; Skip JRE install
${ElseIf} ${FileExists} `C:\Windows\System32\javaw.exe`
    ; Skip JRE install
${ElseIf} ${RunningX64}
    ExecWait '"jre-6u22-windows-x64.exe"'
${Else}
    ExecWait '"jre-6u22-windows-i586-s.exe"'
${EndIf}

Upvotes: 0

Views: 654

Answers (1)

jacknad
jacknad

Reputation: 13739

Needed Unless blocks and DisableX64FSRedirection.

${If} ${RunningX64} 
    ${DisableX64FSRedirection} 
    ${Unless} ${FileExists} "$SYSDIR\javaw.exe" 
        ExecWait '"jre-6u22-windows-x64.exe"'
    ${EndUnless} 
    ${EnableX64FSRedirection} 
${Else}  
    ${Unless} ${FileExists} "$SYSDIR\javaw.exe" 
        ExecWait '"jre-6u22-windows-i586-s.exe"'
    ${EndUnless} 
${EndIf}  

Upvotes: 1

Related Questions