Javadocs are not appearing on Apache netbeans for java 10

青春壹個敷衍的年華 提交于 2019-12-07 16:12:38

问题


Netbeans Version: Apache NetBeans 9.0

Java version: Java 10

No matter what I do, I can't get the javadocs to appear and display method details on anything.

I've gone into the Java Platforms and into the Javadocs, I've set the Zip, unzipped and URL for the javadocs, but it just wont work...

Java Doc: jdk-10.0.1_doc-all

URL: https://docs.oracle.com/javase/10/docs/api

I couldn't find any answers anywhere, they all mentioned adding the docs like I already tried.

Edit Reply: Even with adding the 'java.base/' it still doesn't work. I even completely deleted netbeans and all appdata. Re-downloaded it, installed JDK11, and tried the docs again...but the SAME thing. Am I going insane??


回答1:


You can link to the JDK help documentation in NetBeans using a URL or the file location of the zipped documentation. Both approaches work for me for Java 10 using Apache NetBeans 9.0 RC1:

Obviously you only need one of those entries. Both are shown in the screen shot above purely for addressing your question, and both can be set during the addition of the JDK 10 platform, or at a later time.

For using the file location for JDK Javadocs:

  • Download the Javadoc files to some arbitrary directory.
  • Tools > Java Platforms > Javadoc tab > {your jdk 10 platform} > Add ZIP/folder...
  • Navigate to the downloaded Javadoc file, which was jdk-10-ea+42_doc-all.zip in my case.

For using the URL for JDK Javadocs:

  • Tools > Java Platforms > Javadoc tab > {your jdk 10 platform} > Add URL...
  • Add the URL, which was https://docs.oracle.com/javase/10/docs/api/ in my case.

If you still have problems:

  • Make sure that you are using the latest build of NetBeans 9.0 RC1.
  • Use the specific URL and Javadoc file that I used, since both approaches definitely work for me.
  • If things still aren't working delete the JDK 10 platform, restart NetBeans and try again. (I have no specific reason for suggesting that, but it will only take two minutes to try.)

My personal preference is to use a local zip file rather than a URL since it is faster and you do not need internet access. Here's a screen shot showing the Javadoc for Optional.orElseThrow() which was new in JDK10:


Updated on 11/8/2018 to address the use of OpenJDK 10 with NB 9.0:

  • I deleted all Java Platforms except JDK 1.8 (Default).
  • I closed NetBeans and deleted the cache and user directories as shown in Help > About.
  • I restarted NetBeans and created a trivial Java application that called Optional.orElseThrow() which was added in JDK 10. As expected the project would not compile using the platform JDK 1.8 (Default).
  • I added OpenJDK 10 as a Java platform, but did not specify any Javadoc.

  • I updated the project to use OpenJDK 10 instead of JDK 1.8 (Default). Help for Java 10 methods worked fine without specifying any Javadoc location!




回答2:


The problem is caused by missing the java.base/ on the end of the locator.

java.base, starting with Java 9, is the definition of the foundational APIs of the Java SE platform.

Using https://docs.oracle.com/en/java/javase/11/docs/api/ as URL resource will fail.
Using https://docs.oracle.com/en/java/javase/11/docs/api/java.base/ as URL resource will work.

Same issue for file resources. Add java.base/ at the end of the former file locator and it works.




回答3:


I struggled with this same issue using Apache Netbeans 9 and JDK 11 and this worked for me. If you need the swing components you have to add java.desktop as well. Also, you must have the trailing / for the online resource to work. You think they would check for that and add it if it doesn't exist.

online resource

https://docs.oracle.com/en/java/javase/11/docs/api/java.base/ https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/

local resource unzipped in Ubuntu /opt/jdk/ folder

/opt/jdk/jdk-11.0.1_doc-all/docs/api/java.base

/opt/jdk/jdk-11.0.1_doc-all/docs/api/java.desktop




回答4:


I had the exact same problem with Apache Netbeans 9 and JDK 11. Whatever I did, I could not see Javadoc results in Netbeans. I did succeed in the end. The steps I undertook:

  • I downloaded the jdk-11.0.1_doc-all.zip file.
  • The downloaded file I saved in C:\Program Files\Java\jdk-11.0.1\docs
  • In Netbeans under Tools -> Java Platform, under tab "Javadoc", I added the location of the folder C:\Program Files\Java\jdk-11.0.1\docs

The above steps did not help me, but after I restarted Netbeans64 with "Run as Administrator", it worked like a charm. Maybe something to do with security settings?




回答5:


I changed the jdk from 11 to 8, then configured the suitable Java 8 doc folder. This solved the problem. You have to change the project too.




回答6:


Well, after fighting a lot with NB 11 and OpenJDK 11 Javadoc, I fix it!

Platform: Ubuntu 18.04 Apache NetBeans IDE 11.0 (Build incubator-netbeans-release-404-on-20190319

I could not get to work the javadoc with any of the previous listed method. No HTTP, or local. Nothing work, or partially work. :( But, just in the last minute, when I already felt defeated and was about to jump to ECLIPSE, I think: what about OracleJDK 11?. It's suppose to be the same but... I downloaded the JDK11 from Oracle, uncompress it in a folder and add it as a Java Platform in NB and voila! It's work! It have nothing in Javadoc tab, but it recognize the src and everything is working. I use that platform only for typing since I build everything from console with gradle and the OpenJDK.




回答7:


On Debian/Ubuntu:

apt install openjdk-11-doc

Then add go to:

Tools > Java Platforms > Javadoc tab > {your jdk 11 platform} > Add ZIP/Folder...:

/usr/share/doc/openjdk-11-jre-headless/api/java.base


来源:https://stackoverflow.com/questions/51182338/javadocs-are-not-appearing-on-apache-netbeans-for-java-10

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