What is the “Use '--release' option” in IntelliJ 2018.1 preferences?

前端 未结 1 643
鱼传尺愫
鱼传尺愫 2020-12-17 18:17

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

Use \'--release\' option for

相关标签:
1条回答
  • 2020-12-17 18:56

    The help section can be found here:

    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.

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

    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.

    Discussed in this good answer here.

    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.

    0 讨论(0)
提交回复
热议问题