How do I add the Java API documentation to Eclipse?

前端 未结 14 1421
名媛妹妹
名媛妹妹 2020-11-30 17:34

I have downloaded Java API documentation from http://www.oracle.com/technetwork/java/javase/downloads/index.html#docs and have supposedly attached it to Eclipse using the

相关标签:
14条回答
  • 2020-11-30 17:55

    Old question, but I had current problems with this issue. So I provide you my solution. Now the sources and javadocs are inside the jdk. So, unzip your jdk version.You can see that contanins a "src.zip" file. Here are your needed sources and doc files. Follow the path: Window->Preferences->Java->Installed JREs-> select your jre/jrd and press "Edit" Select all .jar files, and press Source Attachement. Select the "External File..." button, and point it to src.zip file.

    Maibe a restart to Eclipse is needed. (normally not) Now you should see the docs, and also the sources for the classes from jdk.

    0 讨论(0)
  • 2020-11-30 17:55

    Ensure "Preferences" -> "Java" -> "Editor" -> "Hovers" -> "Combined Hover" is checked.

    0 讨论(0)
  • 2020-11-30 17:59

    I just had to dig through this issue myself and succeeded. Contrary to what others have offered as solutions, the path to my happy ending was directly correlated to JavaDoc. No "src.zip" files necessary. My trials and tribulations in the process involved finding the CORRECT JavaDoc to point at. Pointing a Java 1.7 project at Java 8 Javadoc does NOT work. (Even if "jre8" appears to be the only installed JRE available.) Thus, I beat my head against the brick wall unnecessarily.

    Window > Preferences > Java > Installed JREs

    If the JRE of your project is not listed (as happened to me when I migrated a jre7 project to a new jre8 workspace), you will need to add it here. Click "Add..." and point your Workspace at the desired jre folder. (Mine was C://Program Files/Java/jre7). Then "Edit..." the now-available JRE, select the rt.jar, and click "Javadoc Location..." and aim it at the correct javadoc location. For my use:

    For jre7 -- http://docs.oracle.com/javase/7/docs/api/ For jre8 -- http://docs.oracle.com/javase/8/docs/api/

    Voila, hover tooltip javadoc is re-enabled. I hope this helps anyone else trying to figure this problem out.

    0 讨论(0)
  • 2020-11-30 18:00

    Likely a problem with the path that you specified in Javadoc Location. It is pretty finicky. Make sure that it points at the root of where the javadoc starts. It could be a few directories down in the zip you've downloaded.

    0 讨论(0)
  • 2020-11-30 18:00

    if you are using maven:

    mvn eclipse:eclipse -DdownloadSources=true  -DdownloadJavadocs=true
    
    0 讨论(0)
  • 2020-11-30 18:06

    To use offline Java API Documentation in Eclipse, you need to download it first. The link for Java docs are (last updated on 2013-10-21):

    Java 6
    Page: http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u25-doc-download-355137.html
    Direct: http://download.oracle.com/otn-pub/java/jdk/6u30-b12/jdk-6u30-apidocs.zip

    Java 7
    Page: http://www.oracle.com/technetwork/java/javase/documentation/java-se-7-doc-download-435117.html

    Java 8
    Page: http://www.oracle.com/technetwork/java/javase/documentation/jdk8-doc-downloads-2133158.html

    Java 9
    Page:http://www.oracle.com/technetwork/java/javase/documentation/jdk9-doc-downloads-3850606.html

    1. Extract the zip file in your local directory.
    2. From eclipse Window --> Preferences --> Java --> "Installed JREs" select available JRE (jre6: C:\Program Files (x86)\Java\jre6 for instance) and click Edit.
    3. Select all the "JRE System libraries" using Control+A.
    4. Click "Javadoc Location"
    5. Change "Javadoc location path:" from "http://download.oracle.com/javase/6/docs/api/" to "file:/E:/Java/docs/api/".

    It must work as it works for me. I don't need Internet connection to view Java API Documentation in Eclipse anymore.

    0 讨论(0)
提交回复
热议问题