简体   繁体   中英

Eclipse - use OS environment variable in build path

Say I have two Windows environment variables named JAVA8 and JAVA6
which point to the root folders of the respective JDKs.

Can I use the the JAVA8 Windows variable in Eclipse
(to eg add it the build path of a given project)?
I mean can Eclipse refer to %JAVA8% directly once it's set at the OS level?

Also, I want to make this project portable so that I can give
this project to another team member (who might be on Mac OS eg)
with the only requirement for him to create a JAVA8 environment
variable on his OS.

I did quite some searching on the web (incl. in SO), and this seems
impossible (but I doubt such a basic thing would be impossible).

Eclipse expects you to define the available JDK/JREs in 'Preferences > Java > Installed JREs'. In the project Java Build Path you reference this by name rather than path so that it is independent of the actual JDK/JRE location.

You can also use 'Preferences > Java > Installed JREs > Execution Environments' to choose a JRE for things like 'JavaSE-1.8'. Again you can use the Execution Environment name in the Java Build Path.

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