简体   繁体   English

给定的Eclipse项目使用哪个JDK / JRE?

[英]Which JDK/JRE is a given Eclipse project using?

I have a current version of Eclipse (4.5.2) and I've got several JDKs and JREs installed. 我有一个最新版本的Eclipse(4.5.2),并且已经安装了几个JDK和JRE。 How do I determine which specific JDK/JRE a given project is using? 如何确定给定项目使用的是哪个特定的JDK / JRE?

The reason I ask is that I'm trying to figure out which logging.properties file to edit to make my logging work the way I want it. 我问的原因是,我正在尝试找出要编辑的logging.properties文件,以使我的日志记录按我希望的方式工作。

I used -version as a VM argument in my project and it told me: java version "1.8.0_74" Java(TM) SE Runtime Environment (build 1.8.0_74-b02) Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode) 我在项目中使用-version作为VM参数,它告诉我:Java版本“ 1.8.0_74” Java(TM)SE运行时环境(内部版本1.8.0_74-b02)Java HotSpot(TM)64位服务器VM(内部版本) 25.74-b02,混合模式)

Unfortunately, I have both a JDK and a JRE at that level so I'm not sure which one it is using in this project. 不幸的是,我在那个级别上同时拥有一个JDK和一个JRE,所以我不确定它在该项目中使用的是哪个。 Can anyone enlighten me? 谁能启发我?

The JRE system library in my project says [Java1.8SE] in Package Explorer but the individual jars in that library all look like this: rt.jar C:\\Program Files\\Java\\jre7\\lib which suggests that I have a 1.7 jre. 我项目中的JRE系统库在Package Explorer中显示[Java1.8SE],但该库中的各个jar都看起来像这样:rt.jar C:\\ Program Files \\ Java \\ jre7 \\ lib这表明我有一个1.7 jre 。

Can anyone shed some light on this? 谁能对此有所启发?

Create a new class with a new main . 创建一个带有新main的新类。 Your program will then print your version. 然后,您的程序将打印您的版本。

System.out.println(System.getProperty("java.version"));

You can also do this by right-clicking on the JRE System Library at the bottom of the project and then clicking 'Configure Build Path' under 'Build Path'. 您也可以通过右键单击项目底部的JRE系统库,然后单击“构建路径”下的“配置构建路径”来执行此操作。 Then look at 'Libraries'. 然后看“图书馆”。 This tells you what your JRE System Library is. 这告诉您您的JRE系统库是什么。

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

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