Search code examples
javanetbeansjavadocnetbeans-11

Netbeans 11.3 "Cannot perform Show Javadoc here"


Showing Javadoc for standard libraries (java.base, ...) is working fine in my setup.

But including Javadoc for additional libraries fails all the time. I am looking for a hint, what can be done to fix this problem or to get more output for the root cause of this problem.

I have the following source code:

import com.fazecast.jSerialComm.SerialPort;

public class JavaTestAoolication {
    public static void main(String[] args) {
        SerialPort.getCommPorts();
    }
}

I try to add javadoc path for this library via menu Tools -> Java Platforms and tab javadoc.

This results in the following entries in the netbeans configuration file ~/.netbeans/11.3/config/Services/Platforms/org-netbeans-api-java-Platform/default_platform.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE platform PUBLIC "-//NetBeans//DTD Java PlatformDefinition 1.0//EN" "http://www.netbeans.org/dtds/java-platformdefinition-1_0.dtd">
<platform default="yes" name="JDK 11 (Default)">
    <properties>
        <property name="platform.ant.name" value="default_platform"/>
    </properties>
    <javadoc>
...
        <resource>https://fazecast.github.io/jSerialComm/javadoc/</resource>
        <resource>file:/usr/share/htl-libjserialcomm-java/2.6.1/javadoc/api/</resource>
...
   </javadoc>
</platform>

Selecting context menu -> Show Javadoc on SerialPort.getCommPorts() always results in the message:
Cannot Perform show Javadoc here.

But the link is existing:
https://fazecast.github.io/jSerialComm/javadoc/com/fazecast/jSerialComm/SerialPort.html

And also the local folder is existing (without symbolic links):

$ ls -la /usr/share/htl-libjserialcomm-java/2.6.1/javadoc/api/com/fazecast/jSerialComm/SerialPort.html 
-rw-r--r-- 1 user user 115981 Apr  9 17:02 /usr/share/htl-libjserialcomm-java/2.6.1/javadoc/api/com/fazecast/jSerialComm/SerialPort.html

I also try to use file:// instead of file:/. No success.

Any ideas how to solve this problem?


Solution

  • TLDR: I experienced similar problems to you, but there is a fairly simple workaround:

    • Download and unzip the source of the Fazecast code.
    • In NetBeans Use Tools > Library Manager to reference the locally unzipped source.

    Here are the details:

    • Go to https://fazecast.github.io/jSerialComm/ and select the option to download the zip file, as shown in the top right of the screen.
    • The downloaded file is named Fazecast-jSerialComm-v2.6.1-0-gf3d1e89.zip. Unzip that. The *.java source files for the project will be in the unzipped directory ...\Fazecast-jSerialComm-v2.6.1-0-gf3d1e89\Fazecast-jSerialComm-f3d1e89\src\main\java\com\fazecast\jSerialComm.
    • In NetBeans select Tools > Library Manager then click New Library... to create an entry for Fazecast. Then, for that new entry:
      • Click the Classpath tab and click the Add JAR/Folder... button, and navigate to your download of jSerialComm-2.6.1.jar.
      • Click the Sources tab and navigate to the parent directory of the com.fazecast package in the unzipped source directory. In my case this was D:\Downloads\FazecastJSerialComm\Fazecast-jSerialComm-v2.6.1-0-gf3d1e89\Fazecast-jSerialComm-f3d1e89\src\main\java
      • It's counterintuitive, but you don't need to enter anything on the Javadoc tab!

    Once you have done that, close and reopen your source file that's calling Fazecast methods and the javadoc should work. Here's an example for SerialPort.getCommPorts(), where I inserted HELLO WORLD!!! in the javadoc of that method to demonstrate that the local source was being accessed:

    FazecastJavadoc

    Notes:

    • My environment was Windows 10, NetBeans 11.3 and JDK 14, and I created a simple Ant project.
    • You could open an issue report with Fazecast on the issue of not being able to access the online javadocs from NetBeans, since I don't think that is a NetBeans issue. You could also ask them to consider providing a downloadable javadoc file for jSerialComm.
    • An additional benefit of linking to the Fazecast source in NetBeans is that you can open their code by clicking the Open source in editor icon in the javadoc window, as shown in the screen shot above. Navigate > Go to Source or CTRL + Shift + B also work if the cursor is on a Fazecast method.