Search code examples
javaautoit

How to install JRE using AutoIt


I'm trying to configure JRE installation using AutoIt:

If $iJava64 = 1 Then
    $hDownloadJava64 = InetGet("https://www.dropbox.com/s/s68heiccdoxhtii/Java%20Jre%20x64.exe?dl=1", @TempDir & "\Java Jre x64.exe", $INET_FORCERELOAD)
    RunWait(@TempDir & "\Java Jre x64.exe -install")
    $sMessage_stt = $sMessage_stt & "Java Jre x64 -> Done" & @CRLF
    ControlSetText("Processing status", "", "Static1", $sMessage_stt)
EndIf

But that doesn't work. I also tried /S, /q, but it's not working!


Solution

  • Does it work if you do it over the command line? If yes you could use following code:

    RunWait(@ComSpec & ' /c "' & @TempDir & '\Java Jre x64.exe" -install')
    

    Remeber to use ' if you need to use " for the path, because yours has spaces.

    EDIT: Correct parameter:

    RunWait(@ComSpec & ' /c "' & @TempDir & '\Java Jre x64.exe" /s')