How to solve “This element has no attached source and the Javadoc could not be found in the attached Javadoc”?

后端 未结 9 1977
夕颜
夕颜 2020-12-05 19:18

I don\'t get the exact method to do this. I want a method not for a single project for all projects in eclipse. Please tell me how to solve this problem.

相关标签:
9条回答
  • 2020-12-05 19:24

    This is for a jar on your classpath in Eclipse, where you have

    1. attached a javadoc zip which Eclipse for some reason dislikes.

    2. NOT attached a valid source jar.

    The easiest way is to right-click the jar in question (in the referenced jars, not the physical jar) and choose Preferences -> Javadoc. Here give a correct location (zip/URL) to the correct javadoc. Remember to use the "Validate" button to ensure that it is correctly set up.

    0 讨论(0)
  • 2020-12-05 19:26

    I know this is a very late answer, but this will help if anyone is using a gradle project.

    change your build.gradle to include the following:-

    apply plugin: 'java'
    apply plugin: 'eclipse'
    
    eclipse {
        classpath {
            downloadJavadoc = true
            downloadSources = true
        }
    }
    

    This will add both java source and javadoc.

    If this still doesnot work then right click on the Project>Build PAth>Configure Build Path>order and Export > and bring Web App libraries to the bottom Then Close the project and reopen it

    0 讨论(0)
  • 2020-12-05 19:28

    Using Eclipse 4.2.2 on OSX 10.7.5, after I got the lib into "referenced libs", I had to then right click it > Build Path > Configure Build Path > go to Order and Export tab, then highlight the lib I want and move it up to the top with the "up" button. I didn't notice any difference with the checkbox checked or unchecked.

    That's what got it working for me.

    0 讨论(0)
  • 2020-12-05 19:29

    Also, after doing one of these in the UI, you'll see your .classpath file has changed- that jar now has a sourcepath attribute.

    It's probably easier to quit eclipse and edit the rest by hand. Remove the foo-source jar files as separate jars and add them as sourcepath attributes on each classpathentry element.

    0 讨论(0)
  • 2020-12-05 19:30

    Akki's problem also plagued me for much too long. But the fix is super easy.

    If you're using Eclipse (Neon), and

    If you have Maven (highly recommended) with the Eclipse plugin to handle it, and

    If your project is a Maven project (it can be converted into one **),

    Then you can easily add Javadocs to all your jar dependencies at once (if you're also using Spring Boot, there may be about 75 of them!) by doing the following:

    • Right click on your project (in the Project Explorer),
    • Hover over "Maven" to get a submenu, and
    • Select "Download JavaDocs".

    You should see in the lowest right hand corner a status bar that says "downloading sources and javadocs" and a progress bar.

    ** To mavenize your project:

    • Right click on it in the Project Explorer,
    • Hover over "Configure" to get a submenu, and
    • Select "Convert to Maven Project".
    0 讨论(0)
  • 2020-12-05 19:33

    This happened to me after I moved my Android files from one PC to a new PC: I simply copied the folder from P:\Android\ to C:\Android\

    To fix the error (using Eclipse), right-click the library (in my case android.jar) in your project. Click "Properties", click "Javadoc Location", and fix the Javadoc location path.

    For example, I changed it from "file:/P:/Android/android-sdk-windows/docs/reference" to "file:/C:/Android/android-sdk-windows/docs/reference"

    Then click "Validate". Then click "Apply". Then click "OK"

    now hovering over a method or constant gives me the API info again :-)

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