简体   繁体   中英

Eclipse: Default JRE for newly created/imported projects

I am using Java 8 and overtime I either create or import a project the JRE System Library is set to 1.5 I wonder why since I have nothing but Java 8 installed.

I now that I can set a default JRE over

Java->Installed JREs

This would however set a hard coded path to a specific JDK version. I do update my JDK here and then and if I install newer versions I would have to think of upgrading this path too. The command (I am on OS X)

/System/Library/Frameworks/JavaVM.framework/Versions/Current/commands/java_home

points always the latest installed JDK.Can I somehow make Eclipse use always the directory this command is pointing to? Or do I have to hard-code the used JRE?

You can use an 'Execution Environment' (specified in 'Java > Installed JREs > Execution Environments') when you create your Java projects. For Java 8 this would be 'JavaSE-1.8'.

You can then just change which JDK is using for the Execution Environment in the preferences without having to change anything in your projects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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