简体   繁体   English

如何在 eclipse JDK 首选项部分中设置默认 JDK 合规级别和启用版本

[英]How to set default JDK Compliance level and release enabled in eclipse JDK preferences section

I want to perform a PDE build for my RCP product.我想为我的 RCP 产品执行 PDE 构建。 I am compiling my product with JDK 11 but I want to set --release option as 1.8.我正在使用 JDK 11 编译我的产品,但我想将 --release 选项设置为 1.8。 I wanted to know how we can provide a default compliance setting in eclipse.我想知道我们如何在 eclipse 中提供默认的合规性设置。 So I can build my product with eclipse settings.所以我可以使用 eclipse 设置来构建我的产品。

在此处输入图像描述

I want to set --release option as 8. But we can't add release option to <java /> tag.我想将 --release 选项设置为 8。但是我们不能将发布选项添加到<java />标签。 So I need to set a compliance level as 1.8 (by default) in JDT preferences.所以我需要在 JDT 首选项中将合规级别设置为 1.8(默认情况下)。

Can anyone answer how we can set default compliance level and enable --release option in eclipse?谁能回答我们如何在 eclipse 中设置默认合规级别并启用 --release 选项?

The eclipse version is 4.12 and I want to set release option as 8 for PDE build. eclipse 版本是 4.12,我想将发布选项设置为 8 用于 PDE 构建。

What all the options I have tried我尝试过的所有选项

  1. Set compliance level to 1.8 but it is setting for particular workspace.将合规级别设置为 1.8,但它是为特定工作区设置的。 It is not setting for default.它没有设置为默认值。
  2. I have copied org.eclipse.jdt.core.prefs from workspace to \eclipse\configuration.settings我已将org.eclipse.jdt.core.prefs从工作区复制到\eclipse\configuration.settings
  3. Provided javacSource & javacTarget (But here we need to provide --release value)提供了 javacSource & javacTarget (但这里我们需要提供 --release 值)

Thanks in advance.提前致谢。

Eclipse works on workspace level. Eclipse 在工作区级别上工作。 So all the configuration are stored in workspace.所以所有的配置都存储在工作区中。 Project > Properties: Java Compiler will set the java compiler version to one particular version for a workspace.项目 > 属性:Java 编译器会将 java 编译器版本设置为工作区的一个特定版本。 You may not be able to set it for all workspace in one shot in Eclipse.您可能无法在 Eclipse 中一次性为所有工作区设置它。

I would suggest the following我建议以下

  1. set JDK_HOME environment variable to required version of Java将 JDK_HOME 环境变量设置为所需版本的 Java
  2. Place required Java version path to PATH variable in the begining.将所需的 Java 版本路径放在开头的 PATH 变量中。

then start eclipse and check.然后启动 eclipse 并检查。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM