Netbeans 11 Javadoc Not Appearing?

心不动则不痛 提交于 2020-04-29 09:56:06

问题


I have a question very similar to Javadocs are not appearing on Apache netbeans for java 10 in the sense that I can't seem to add javadoc support to my Apache Netbeans 11 release, or the maven project that I'm working on.

Here is the overview that I have:

As you can see, the javadoc is added in the URL section, but it does not appear in the code editor, even after a restart.

The URL I added: https://docs.oracle.com/en/java/javase/11/docs/api/index.html

But this doesn't work.

How can I resolve this?


回答1:


Whilst Netbeans 11 runs well with Ubuntu 18's apt packet "openjdk-11-jdk", when it comes to NB's source-editor's pop-up-Javadoc and "show Javadoc" function (which opens an external browser), both NB functions don't work on a standard Ubuntu installation.

Because NB's Javadoc functions seem so dislike the "openjdk-11-jdk" packet's file structure in "/usr/lib/jvm/java-11-openjdk-…" which is slightly different to the one from the downloadable Openjdk11 zip bundle.

Here's the solution to make both functions work:

  • Download the Openjdk11 zip bundle for Linux from the Openjdk's website: https://jdk.java.net/archive/
  • Unzip it, so that its content is in a folder, like for example "openjdk11"
  • In NB go to the menu "Tools → Java platforms". Add a new platform and select the unzipped folder (openjdk11 for example). NB finds out the correct sources folders inside the src.zip file.

Finally in your NB project property, change in "Libraries" the "Java Platform" to your newly added Openjdk11 platform, and now NB's pop-up-Javadoc works again.

To also have NB's "show Javadoc" functionality, do this additional step please:

  • Download Oracle's Javadoc11 zip file and unzip it.
  • Now go to NB's "Java platform" dialogue again and. In the previously added platform "Openjdk11" go to the third tab named "Javadoc" and add as folders all the "java*" subfolders inside the "doc/api/" folder.

That's it. Hope it helps.

Btw, now NB still runs inside Ubuntu's installed Openjdk11 JVM (from the paket "openjdk-11-jdk") and will get apt-automatic updates, however your projects use the unzipped JVM to run. This is no big deal however, since NB always uses a new instance of its used JVM or of the project's JVM to run a project.




回答2:


I've yet to see somebody who managed to add Javadoc 11 to Netbeans 11.

But there's a work-around which seems to work for many JDK classes, but not for all. If anybody knows how to solve the problem for all JDK classes, please say so, thanks.

Here's the workaround, doing well under Ubuntu 18 Linux with Openjdk11 from the Ubuntu repository, and probably also under other platforms:


Firstly it's strange how we have to add the Javadoc at all. In NB's menu Tools → Java Platforms there's a tab Sources and Javadoc.

1) I tried to use the tab Javadoc first, and had to add all the folders beginning with "java." from the main folder "javadoc/api/" from an unzipped Javadoc11 bundle. This way some JDK functions show the correct Javadoc pop-up help, however many functions just show an empty space, like for example when in Netbeans I enter:

BigInteger big;
big. _

Then the pop-up comes and lists all BigInteger functions but their Javadoc is empty each.

So I tried another approach:


2) From the same NB menu Tools → Java Platforms in the tab Javadoc I removed all entries, and used the other tab Sources where I added all the folders beginning with "java." from an unzipped Java11 source bundle (file src.zip).

This way for many more JDK classes and functions their pop-up window works fine, like the mentioned BigInterger one.

However for certain classes from the java.sql package and probably from others, too, I can't make it to work. For example I enter in NB:

java.sql.Statement stat;
stat. _

Then I get a pop-up listing all functions, but for many there's a message Javadoc not found in the pop-up window. Like these functions:

stat.addBatch(…)
stat.execute(…)
stat.executeUpdate(…)
etc.

For the following functions however the pop-up window shows the correct Javadoc:

stat.cancel(…)
stat.close(…)
stat.executeBatch(…)
etc.


来源:https://stackoverflow.com/questions/56161666/netbeans-11-javadoc-not-appearing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!