Change the JRE / JDK in Eclipse on Mac OS X and access the sources
source link: https://marco.dev/2016/04/20/change-the-jre-jdk-in-eclipse-on-mac-os-x-and-access-the-sources/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
java-version.com: What's new in Java 16? 15? Keep up to date!
Change the JRE / JDK in Eclipse on Mac OS X and access the sources
Sometimes it happen that we have to change or add the JDK/JRE version used by eclipse and/or we want to access the correct source code of the JDK.
Here the step by step procedure under OS X:
- Open File -> Preferences
- Search for the Installed JRE (currently the 1.8.0_73) and click ‘Add…’
3. Select the JRE Home
If you installed the SDK using the installer it should be in:
/Library/Java/JavaVirtualMachines/jdk1.[version].jdk/Contents/Home/
-
To access the sources select rt in the System Libraries and click Source Attachment …
-
Choose the src.zip file from the directory containing the JDK
- Confirm and set the new JRE as the default one clicking on the checkbox near the name
The change is effective only for the new projects, if you want to change the JDK/JRE for an existing project:
- Click with the right button on the project and choose ‘Properties’. Search for ‘Java Build Path’ and select the JRE under Libraries. Click te ‘Edit’ button.
- Choose the new JRE
- (Optional) Restart Eclipse
Without a restarting if you try to call the JRE sources Eclipse will throw an error
Author
Marco Molteni
Marco Molteni Blog
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK