How to attach source or JavaDoc in eclipse for any

2019-01-06 11:46发布

Presently I'm working with JavaFX. Whenever I hover over a method of JavaFX its gives me the following error:

'Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found'

How should I resolve this? How can I attach the javadoc or source so that I could see the description of the methods?

11条回答
Juvenile、少年°
2楼-- · 2019-01-06 11:50

I couldn't get the "Attach source..." method to work either, and I tried many different ways. The Javadocs for JavaFX are installed in Program Files\Oracle\JavaFX 2.x SDK\docs. Another way to install the Javadocs is:

  1. Right click on the project, select Properties
  2. Select Libraries on the right side of the tab
  3. At the right top side of the tab, you may see "Default JavaFX Platform" or something similar. Click on the Manage Platforms button. (You can also install this default platform from here if you haven't got this already).
  4. In the Java Platform Manager tab which appears, select "Default JavaFX Platform" on the left side, and then click on the JavaFX tab on the right side of the window.
  5. One of the entry fields is labeled "JavaFX Javadoc". Click the "Browse" button next to this field and browse to the installed docs file mentioned above.

Hope this helps some people who were as puzzled as I was.

查看更多
男人必须洒脱
3楼-- · 2019-01-06 11:51
  1. Download jar file containing the JavaDocs.
  2. Open the Build Path page of the project (right click, properties, Java build path).
  3. Open the Libraries tab.
  4. Expand the node of the library in question (JavaFX).
  5. Select JavaDoc location and click edit.
  6. Enter the location to the file which contains the Javadoc (the one you just downloaded).
查看更多
Animai°情兽
4楼-- · 2019-01-06 11:53

Neither Project/Properties/Javadoc Location nor Project/Properties/Java Build Path/Libraries had not helped me until I picked and moved up in "Order and Export" tab of "Java Build Path" "Android Dependencies" and added-in-library.jar. I hope is will be useful.

查看更多
一纸荒年 Trace。
5楼-- · 2019-01-06 11:53

In addition to the answer of @dhroove (would have written a comment if I had 50 rep...)

The link has changed to: http://docs.oracle.com/javafx/2/api/

At least my eclipse wasn't able to use the link from him.

查看更多
够拽才男人
6楼-- · 2019-01-06 11:55

If you are using maven just do:

mvn eclipse:eclipse -DdownloadSources=true  -DdownloadJavadocs=true
查看更多
ゆ 、 Hurt°
7楼-- · 2019-01-06 11:57

This trick worked for me in Eclipse Luna (4.4.2): For a jar file I am using (htsjdk), I packed the source in a separate jar file (named htsjdk-2.0.1-src.jar; I could do this since htsjdk is open source) and stored it in the lib-src folder of my project. In my own Java source I selected an element I was using from the jar and hit F3 (Open declaration). Eclipse opened the class file and showed the button "Attach source". I clicked the button and pointed to the src jar file I had just put into the lib-src folder. Now I get the Javadoc when hovering over anything I’m using from the jar.

查看更多
登录 后发表回答