【问题标题】:NSIS Downloading timeoutNSIS 下载超时
【发布时间】:2020-01-16 07:23:57
【问题描述】:

我已经构建了一个 NSIS,它已经运行了几个月, 突然JRE出现下载失败的问题,我已经测试了下载链接是好的,如果有人可以帮助,请提出可能的解决方案,部分代码如下所列:

!define JRE_URL "javadl.sun.com/webapps/download/AutoDL?BundleId=69476"
Function GetJRE
    MessageBox MB_OK "${PRODUCT_NAME} uses Java ${JRE_VERSION}, it will now \
                     be downloaded and installed"

    StrCpy $2 "$TEMP\Java Runtime Environment.exe"
    nsisdl::download /TIMEOUT=30000 ${JRE_URL} $2
    Pop $R0 ;Get the return value
            StrCmp $R0 "success" +3
            MessageBox MB_OK "Download failed: $R0"
            Quit
    ExecWait $2
    Delete $2
FunctionEnd


Function DetectJRE

Push $0
Push $1

; for 64-bit registry
SetRegView 64
ReadRegStr $3 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
;MessageBox MB_OK "JRE CurrentVersion $3"
;StrCmp $3 ${JRE_VERSION} Done

StrCpy $0 $3 1 0
StrCpy $1 $3 1 2
StrCpy $4 "$0$1"
;MessageBox MB_OK "JR CurrentVersion $JR_VERSION"
;MessageBox MB_OK "JR CurrentVersion $4"
IntCmp 16 $4 Done JavaVerNotCorrect JavaVerNotCorrect # if not JRE 1.6,download from the web


JavaVerNotCorrect:
Call GetJRE

Done:
      Pop $1
      Pop $0
FunctionEnd

【问题讨论】:

  • JRE_URL 缺少协议,因此不是有效的 URL
  • @idleberg,嗨,我也尝试javadl.sun.com/webapps/download/AutoDL?BundleId=52252,但没有成功
  • 尝试一个以协议为前缀的有效 URL(例如 http://
  • @idleberg 试过 https:+//javadl.oracle.com/webapps/download/AutoDL?BundleId=69476 http:+//javadl.sun.com/webapps/download/AutoDL?BundleId= 58134 都没有成功,但是 URL 是在 NSIS 之外工作的~ https 在这里被删除了,只是我不知道为什么

标签: java nsis


【解决方案1】:

nsisDl 使用自定义 HTTP 库。请改用INetC,它使用与 Internet Explorer 相同的 HTTP 库。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-05-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-15
    相关资源
    最近更新 更多