IntelliJ 2018.1 首选项中的“使用 '--release' 选项"是什么? [英] What is the “Use '--release' option” in IntelliJ 2018.1 preferences?

查看:41
本文介绍了IntelliJ 2018.1 首选项中的“使用 '--release' 选项"是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 IntelliJ 2018.1 的首选项(构建、执行、部署 > 编译器 > Java 编译器)中有一个复选框,标记为:

In the preferences for IntelliJ 2018.1 (Build, Execution, Deployment > Compiler > Java Compiler) is an checkbox labeled:

使用--release"选项进行交叉编译(Java 9 及更高版本)

Use '--release' option for cross-compilation (Java 9 and later)

我在网上搜索时找到了相关信息.这 "?"单击帮助图标时会出现 404 错误.

I found for information when doing an internet search. The "?" help icon give a 404 error when clicked.

这个选项的目的/功能是什么?

What is the purpose/function of this option?

推荐答案

帮助部分 可以在这里找到:

默认情况下,此选项处于选中状态.IntelliJ IDEA 从需要交叉编译时的项目设置和自动为 Java 9 应用 --release 编译器选项.

By default, this option is selected. IntelliJ IDEA deduces from project settings when the cross-compilation is needed and automatically applies the --release compiler option for Java 9.

什么是 --release 选项?这是一个新的命令行选项,在 JEP 247: Compile for Older Platform Versions.

What is the --release option? It is a new command-line option, defined in JEP 247: Compile for Older Platform Versions.

定义了一个新的命令行选项 --release,它会自动配置编译器以生成将链接到给定平台版本的实现的类文件.

A new command-line option, --release, is defined, which automatically configures the compiler to produce class files that will link against an implementation of the given platform version.

在此这里有很好的答案中进行了讨论.

另请查看 IDEA-184333 了解为什么在 IDE 中添加此选项的背景.简而言之,有些用户只需要为其项目指定-source-target 版本,而无需设置-bootclasspath 选项.

Also check IDEA-184333 for the background why this option was added in the IDE. In short, some users need to specify only -source and -target versions for their projects without also setting the -bootclasspath option.

这篇关于IntelliJ 2018.1 首选项中的“使用 '--release' 选项"是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆