How do you install the source for the java libraries in Eclipse?
WHat do you mean with java source? The java.lang package? Because there shouldn't be a need to "install" them. Creating a new Java Project ( any kind of Java Project) should be enough. Could you describe your problem in more detail?
You can do it in the project preferences, but I find quite faster just to ctr+click over a object or class defined in the standard library and then "attach source" in the page that will gently inform you that there are no sources attached.
You then can point to the "src.zip" in your JDK distribution.
The way that I do it:
Prerequisite: you have the source downloaded. It comes with the JDK. (src.zip)
- Open up a Java file
- Ctrl + Click on a class name.
- Click on the button that says 'Attach Source'
- Locate the src.zip file. (Usually in the JDK install location)
- Now you have the source installed!
This happens automatically if you set up a JDK rather than a JRE.
Normally, when you start eclipse, it sets up the JRE that was used to start eclipse. You'll usually want to override this with a JDK so you get the source. To do this:
- First, make sure you have a JDK installed (and not just a JRE)
- Start eclipse
- Go to Window->Preferences->Java->Installed JREs
- Press Add...
- Choose "Standard VM" and press "Next..."
- Press "Directory...", select the JDK installation directory and press "Ok"
- Press "Finish"
- Make sure you check the box next to the new JDK
- Press "Ok" to finish up
This will set up the source properly for you.