Skip to content
欢迎扫码关注公众号

JEP 231: Remove Launch-Time JRE Version Selection | 移除启动时的 JRE 版本选择

摘要

移除在 JRE 启动时请求一个非正在启动的 JRE 版本的能力。

动机

"多个 JRE"(mJRE)功能允许开发人员指定可以用于启动应用程序的 JRE 版本或版本范围。版本选择条件可以在应用程序的 jar 文件的清单条目中指定(JRE-Version),或者作为 java 启动器的命令行选项(-version:)。如果启动的 JRE 版本不满足条件,则启动器将搜索满足条件的版本,并启动该版本。

实际上,部署应用程序需要的不仅仅是选择特定的 JRE。现代应用程序通常通过 Java Web Start (JNLP)、本机操作系统的打包系统或主动安装程序进行部署,所有这些技术都有自己的方式来查找、甚至有时安装和更新应用程序的适当 JRE。

mJRE 功能只解决了部署问题的一部分。此外,当它在 JDK 5 中引入时并没有完全记录:-version: 选项在 java 命令的文档中提到,但 JRE-Version 清单条目在任何常规 JDK 文档或 Java SE 平台规范中都没有提到。据我们所知,这个功能很少被使用。它使 Java 启动器的实现变得复杂,难以维护和增强。

描述

移除 mJRE 功能。对启动器进行以下修改:

  • 如果命令行中使用了 -version: 选项,则发出错误消息并退出,

  • 如果在 jar 文件中找到 JRE-Version 清单条目,则发出警告消息并继续。

之所以在第二种情况下使用警告而不是致命错误,是因为旧的 jar 文件可能存在该清单条目,而这些文件不容易修改,因此最好是继续而不是中止。我们计划在 JDK 10 中将此情况更改为致命错误。

测试

需要进行测试以确保移除了该功能,并正确报告相应的警告和错误。

Page Layout Max Width

Adjust the exact value of the page width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the page layout
A ranged slider for user to choose and customize their desired width of the maximum width of the page layout can go.

Content Layout Max Width

Adjust the exact value of the document content width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the content layout
A ranged slider for user to choose and customize their desired width of the maximum width of the content layout can go.