openjfx-docs icon indicating copy to clipboard operation
openjfx-docs copied to clipboard

How to add javadoc in Netbeans

Open ThomasDaheim opened this issue 7 years ago • 10 comments

After getting most of the things up and running with Java11 there is one thing I still haven't figure out: how can I attach javadoc for JavaFX11 in Netbeans?

For OpenJDK 11 it worked with adding https://docs.oracle.com/en/java/javase/11/docs/api in the platform manager. But I haven't found any documentation on how to do it for JavaFX...

Any pointers are appreciated, Thomas

ThomasDaheim avatar Nov 24 '18 15:11 ThomasDaheim

The link for the JavaFX 11 docs is: https://openjfx.io/javadoc/11/

A link to the each of the JavaFX modules javadoc jars can be found in Maven central, like: https://repo1.maven.org/maven2/org/openjfx/javafx-graphics/11.0.1/javafx-graphics-11.0.1-javadoc.jar

or you can download it from your Gradle/Maven build, like: compile "org.openjfx:javafx-graphics:11.0.1:javadoc" (same goes for sources)

IntelliJ pics up all the sources/javadoc from the dependencies, I'm not sure if NetBeans can do the same. I've tried to add it to the JavaPlatform sources/JavaDoc tabs to no avail (NetBeans 10.0vc4).

Do you know how to include those javadocs jars on NetBeans?

jperedadnr avatar Nov 24 '18 17:11 jperedadnr

Sorry, I don't have a clue. Will play around and see if I can get it to work.

ThomasDaheim avatar Nov 25 '18 19:11 ThomasDaheim

Some more insights from my end

I have tried various ways to attach the javadocs using the path given above. In all cases I get errors saying "No javadoc for javafx-controls-11-win.jar available." Note the -win in the filename.

The same happens when I want to attached sources from the src.zip from the sdk: "No sources for javafx-controls-11-win.jar available." Again the reference to -win.

When I right-click on the dependencies and click on "Download sources" various steps have been executed downloading javadoc and sources and placing them under .gradle\caches\modules-2\files-2.1\org.openjfx\javafx-*. So it seems that Netbeans gets confused by the dependency to the -win jars and doesn't find the sources/javadocs without that part in the filename.

Observation: Initially the error message in Netbeans is

Javadoc not found. Either Javadoc documentation for this item does not exist or there is no attached Javadoc to the JAR file containing this item:XXX\.gradle\caches\modules-2\files-2.1\org.openjfx\javafx-controls\11\af8d24de44e16a19ae959028eb23a48c145fb682\javafx-controls-11-win.jar

When I manually rename javafx-controls-11-javadoc.jar to javafx-controls-11-win-javadoc.jar it changes to only

Javadoc not found. Either Javadoc documentation for this item does not exist or you have not added specified Javadoc in the Java Platform Manager or the Library Manager.

So the -win seems to be significant. Probably, after finding the javafx-controls-11-win-javadoc.jar in the proper location then something inside the jar file is missing -win so that parsing fails. But I surely don't know enough here to have any clues.

ThomasDaheim avatar Nov 28 '18 21:11 ThomasDaheim

Are there some news about this? I think netbeans takes the source files (eg javafx-graphics-12-ea+4-sources.jar) for the javadoc rendering (strg+space) If I rename it from javafx-graphics-12-ea+4-sources.jar to javafx-graphics-12-ea+4-win-sources.jar under the gradle cache it works. So Netbeans has a Problem with the missing -win .....

chrismaster avatar Dec 10 '18 12:12 chrismaster

No news from end only. I only made the file name changes in the gradle cache and now it works on my end as well :-) Thanks for the tip! At least, we have a workaround now...

ThomasDaheim avatar Dec 10 '18 18:12 ThomasDaheim

Playing with the workaround, it works fine, with the following consideration: NetBeans only adds javadoc/source jars for a jar with the exact same name and -javadoc/-source suffix.

This means that depending on how the dependencies are added to the project, you will have to apply a different solution.

If you use the local JavaFX SDK, where each module has a jar like javafx.graphics.jar (not empty), then you will need to add to NetBeans->Tools->Java Platforms->JDK 11 -> JavaDoc a jar like javafx-graphics-javadoc.jar (same applies for sources, and other modules).

If you use Maven or Gradle, then the modules are javafx-graphics-11.0.1.jar (empty) and javafx-graphics-11.0.1-win.jar (or -mac, -linux). Then the fix, as mentioned, will be adding javafx-graphics-11.0.1-win-javadoc.jar (same applies for sources, and other modules).

jperedadnr avatar Dec 17 '18 09:12 jperedadnr

Sounds like something worth documenting :-)

Any idea how this could e.g. be included in build.gradle to avoid the manual workaround? Unfortunately, I don't have any clue how this could be achieved...

ThomasDaheim avatar Dec 17 '18 17:12 ThomasDaheim

For reference:

Maven workaround: https://stackoverflow.com/questions/54278159/javafx-11-in-netbeans-10-with-maven-has-no-sources-javadocs

NetBeans related issue: https://issues.apache.org/jira/browse/NETBEANS-1396

jperedadnr avatar Jan 20 '19 20:01 jperedadnr

For java and javafx using OpenJDK, try adding /usr/share/doc/openjdk-11-doc/api/java.base/ or any /usr/share/doc/openjdk-xxxx/java.base/ to your platform javadocs. The folder you choose should just contain a java and a javafx folder.

derived from solution suggestion for jre 11: https://stackoverflow.com/a/57131296/9597363

opport avatar Jul 28 '19 23:07 opport

I created NETBEANS-3296 to track all the errors related to using the JavaFX Javadoc and Sources in NetBeans. An identical copy of the issue description is on GitHub at jgneff/netbeans-doc-src.

jgneff avatar Nov 02 '19 17:11 jgneff