Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
62 lines (41 sloc) 4 KB
id title date author layout guid permalink categories tags
628
Change the JRE / JDK in Eclipse on Mac OS X and access the sources
2016-04-20 14:19:40 +0000
Marco Molteni
post
/2016/04/20/change-the-jre-jdk-in-eclipse-on-mac-os-x-and-access-the-sources/
Eclipse
java
tutorial
eclipse
ide
java
jdk
tutorial

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:

  1. Open File -> Preferences

2016-04-20_13-53-18

  1. Search for the Installed JRE (currently the 1.8.0_73) and click ‘Add…’

2016-04-20_11-57-153. Select the JRE Home

If you installed the SDK using the installer it should be in:

/Library/Java/JavaVirtualMachines/jdk1.[version].jdk/Contents/Home/2016-04-20_11-58-59

  1. To access the sources select rt in the System Libraries and click Source Attachment …2016-04-20_11-58-59_2

  2. Choose the src.zip file from the directory containing the JDK

2016-04-20_11-59-27

  1. Confirm and set the new JRE as the default one clicking on the checkbox near the name 2016-04-20_12-00-23_2

 

The change is effective only for the new projects, if you want to change the JDK/JRE for an existing project:

  1. 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.

2016-04-20_12-01-12

  1. Choose the new JRE

2016-04-20_12-01-33

  1. (Optional) Restart Eclipse

Without a restarting if you try to call the JRE sources Eclipse will throw an error

2016-04-20_12-02-29