禁用 Java 版本过期提示

禁用 Java 版本过期提示

我们的环境中运行着 IE9 和 Java 1.7 Update 51 (WIN7),我费了好大劲才摆脱以下弹出窗口。

Java 版本已过时

自更新 55 发布以来,用户在进入 Java 页面时会收到以下提示。当然,如果他们点击了“稍后”,Java 应用程序将运行,世界将安全。但每个人点击的内容不同,而我的工作就是引导大家朝着正确的方向前进。

我发现,通过将以下注册表项添加到 HKCU

HKCU\Software\AppDataLow\Software\JavaSoft\DeploymentProperties /v 部署.expiration.check.enabled /t REG_SZ /d false /f

它会抑制提示。所以我计划遍历所有用户配置文件并添加密钥。但是,重新启动后,我的密钥被删除,下次启动 Java 应用程序时,我会收到提示。

我正在为我的环境准备更新 55,并希望在 Java 的未来版本中摆脱此提示。

我还尝试使用deployment.properties包含以下数据的文件:

部署.到期.检查.已启用=false 部署.到期.决定.抑制.10.51.2=true 部署.到期.决定.10.51.2=稍后

C:\Users\%username%\AppData\LocalLow\Sun\Java\Deployment安装 Java 后, 我将该文件放在用户目录中。

那也没有用。

答案1

我也一直在努力解决这个烦恼,我发现HKCU\Software\AppDataLow\Software\JavaSoft\DeploymentProperties注册表项从用户的deployment.properties文件中获取其值。我一直在删除该文件,重新创建它,然后在Java加载之前写入我想要的属性/值。过去两天,我一直在Windows 7 32位和64位测试计算机上成功运行所有用户启动。

这是一个对我有用的 PowerShell 函数:

Function JavaProperties
{
    $userProfile = $Env:USERPROFILE
    Remove-Item -Path "$($userProfile)\AppData\LocalLow\Sun\Java\Deployment\deployment.properties" -Force

    New-Item -Path "$($userProfile)\AppData\LocalLow\Sun\Java\Deployment" -ItemType File -Name "deployment.properties"

    $deployFroperties = Get-ChildItem -Path "$($userProfile)\AppData\LocalLow\Sun\Java\Deployment" -Force -ErrorAction SilentlyContinue | Where{$_.Name -eq "deployment.properties"} | Select -ExpandProperty FullName
    $expDecision = New-TimeSpan -Start $($(Get-Date).ToString()) -End "January 1, 2020 11:59:00 PM" | Select -ExpandProperty TotalMilliseconds
    $expDecision

    Add-Content -Path $deployFroperties -Value "deployment.expiration.decision.suppression.10.51.2=true" -Force
    Add-Content -Path $deployFroperties -Value "deployment.expiration.decision.10.51.2=later" -Force
    Add-Content -Path $deployFroperties -Value "deployment.expiration.decision.timestamp.10.51.2=$expDecision" -Force
    Add-Content -Path $deployFroperties -Force -Value "deployment.system.tray.icon=true"


}#End Function JavaProperties

答案2

另外,我发现了一些东西 Java web start 在 IDA6 Hexrays 中反编译 c:\Program Files (x86)\Java\jdk1.8.0_66**jre\bin\plugin2\npjp2.dll**

涉及这些设置:

HKEY_CURRENT_USER, SOFTWARE\AppDataLow\SOFTWARE\JavaSoft\DeploymentProperties\pending
    deployment.expiration.decision.11.66.2 = update|block|later
    deployment.expiration.decision.suppression.11.66.2  true
    deployment.expiration.decision.timestamp.11.66.2    86401..18446744073709551616 (<- 0xFFFFFF FFFFFF)

HKEY_CURRENT_USER, SOFTWARE\AppDataLow\SOFTWARE\JavaSoft\DeploymentProperties
    deployment.expiration.decision.11.66.2
    deployment.expiration.decision.suppression.11.66.2
    deployment.expiration.decision.timestamp.11.66.2

    deployment.webjava.enabled  false
    deployment.expiration.decision.ttl.11.66.2      86401..18446744073709551616 (<- 0xFFFFFF FFFFFF)

对于低于 Windows Vista 的版本,省略“SOFTWARE\AppDataLow\”部分

所以请随意尝试一下,你也可以尝试这些值环境设置像这样

启动浏览器

set deployment.expiration.decision.11.66.2=later
set deployment.expiration.decision.suppression.11.66.2=true
Firefox.exe %*

好的就这样。

最后是一些伪代码。请将其视为提示。不要太认真 - 如果它令人困惑,请忽略它。

BOOL __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
    StringCompare
        ~otherStrings~ VIA  mbscmp
        ~timestamp~ VIA sscanf "%llu" (<-unsigned long long int)


GetFromEnvOrReg_Depl_pending FORALL 
    deployment.expiration.decision.11.66.2
    deployment.expiration.decision.suppression.11.66.2
    deployment.expiration.decision.timestamp.11.66.2

    deployment.expiration.decision.11.66.2 == 
        update 1
        block 2
        later 3
    if NoValidValue
        GetFromEnvOrReg_Depl FORALL 
            deployment.expiration.decision.11.66.2
            deployment.expiration.decision.suppression.11.66.2
            deployment.expiration.decision.timestamp.11.66.2



    deployment.expiration.decision.suppression.11.66.2
        true

    deployment.expiration.decision.timestamp.11.66.2


    GetFromEnvOrReg_Depl    
        deployment.webjava.enabled
            false
    if success return false

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ unfinished
    deployment.expiration.decision.ttl.11.66.2
        ttl+604800 (or +10 if decision is 'later' )
    compare is bigger as timestamp
    if ... decision is not 'block' return false
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


    FUNC GetFromEnvOrReg_Depl_pending ( $Value )
        MSVCR100.getenv
        if success return $result

        RegOpenKeyExA
            HKEY_CURRENT_USER

            isVistaOrAbove 
                    SOFTWARE\AppDataLow\SOFTWARE\JavaSoft\DeploymentProperties\pending
                    SOFTWARE\JavaSoft\DeploymentProperties\pending

        RegQueryValueExA $Value
        if success Return $result

    FUNC GetFromEnvOrReg_Depl ( $Value )
        *same* but with 
        SOFTWARE\JavaSoft\DeploymentProperties

        FUNC isVistaOrAbove
            GetVersionExA
                VersionInformation.dwPlatformId == VER_PLATFORM_WIN32_NT (2) &&
                VersionInformation.dwMajorVersion >= 6  

相关内容