简体   繁体   中英

How to get location of currently selected Installed JRE?

As you know in Eclipse there is a way to specify the preferred JRE to use (Windows | Preferences | Java | Installed JREs). So I need to get the location of currently selected JRE as a preferred. How can I do that? The similar questions on this site are with no proper answers and it is not seams easy to find what I need in Eclipse forums.

I'm developing plugin for Eclipse and, I guess, there should be specific set of APIs to work with Eclipse preferences but can not figure out how to find it.

Update: I need to get the location programmatically, from my own plugin. And it should work for Windows and Linux.

Take a look at this registry key (on Windows):

HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Runtime Environment

You can use RegOpenKey() and RegQueryValueEx() to query the key/value you need.

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