简体   繁体   English

如何在基于 NetBeans 的项目中将 javaDoc 添加到我的 Java 代码中?

[英]how to add javaDoc to my Java code in a NetBeans based project?

How can I add JavaDoc or other document to netbeans ?如何将 JavaDoc 或其他文档添加到 netbeans ?
I try with this way :我尝试这种方式:

Tools >> Java Platform >> JavaDoc Tab >> JavaDoc.zip (in my desktop) 

but in editor when I press Ctrl + Space in tooltiptext this message shown :但是在编辑器中,当我在 tooltiptext 中按Ctrl + Space时,会显示此消息:

Javadoc not found.未找到 Javadoc。 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.此项目的 Javadoc 文档不存在,或者您没有在 Java 平台管理器或库管理器中添加指定的 Javadoc。

I tried restarting NetBeans but this was the result:我尝试重新启动 NetBeans,但结果如下:

在此处输入图像描述

try this in NetBeans IDE在 NetBeans IDE 中试试这个

  1. Choose Tools > Java Platform Manager from the main window.从主窗口中选择工具 > Java 平台管理器。
  2. Select the platform to which you want to add Javadoc in the left panel of the dialog box.在对话框的左侧面板中选择要添加 Javadoc 的平台。
  3. In the Javadoc tab, click Add ZIP/Folder and specify the location of the Javadoc files.在 Javadoc 选项卡中,单击 Add ZIP/Folder 并指定 Javadoc 文件的位置。
  4. Click Close.单击关闭。

Hope this helps.希望这可以帮助。

You can't usually just add the javadoc zip as a separate library (at least this hasn't worked for me in the past.) In the libraries section you need to select the library you want to add the Javadoc for and then add the Javadoc jar for that specific library.您通常不能只将 javadoc zip 添加为单独的库(至少这在过去对我不起作用。)在库部分中,您需要选择要为其添加 Javadoc 的库,然后添加该特定库的 Javadoc jar。

Restart Netbeans then that should work.重新启动 Netbeans 然后应该可以工作。 Though of course if there really is no Javadoc for that method you still won't get any (I've fallen into that trap a couple of times before!)当然,如果该方法确实没有 Javadoc,您仍然不会得到任何(我之前曾多次陷入该陷阱!)

If you are using maven in your project then follow below steps to attach Java docs for your attached libraries.如果您在项目中使用 maven,请按照以下步骤为您附加的库附加 Java 文档。

  1. Right click on "Dependencies" folder of your project.右键单击项目的“依赖项”文件夹。
  2. Then choose "Download javadoc" option然后选择“下载javadoc”选项
  3. It will download javadoc of your libraries and attached it.它将下载您的库的 javadoc 并将其附加。
  4. Now when you will press ctl + space then you will see docs for that library.现在,当您按下 ctl + space 时,您将看到该库的文档。

and If you want to add javadoc for particular library then follow the options as suggested by Himanshu Soni.如果您想为特定库添加 javadoc,请按照 Himanshu Soni 建议的选项进行操作。

You followed the very right procedure, I've been threw this right before I write this answer, and as for this is the first result that shows up when you Google the problem, I think that many people will find it handy and save their time, the solutions is:你遵循了非常正确的程序,在我写这个答案之前我已经被抛出了这个问题,至于这是你谷歌问题时出现的第一个结果,我认为很多人会发现它很方便并节省他们的时间,解决方法是:

UNZIP the JavaDoc.zip file that you are referring to ( which is supposed to be jdk-7u4-apidocs.zip for JavaSE 7 docs) and repeat the same procedure, which is Tools --> Java Platforms --> Javadoc ( tab ) then press " Add Zip/Folder, and point to the unzipped folder instead of the zipped one, restart NetBeans, and it will work smooth and direct.解压缩您引用的 JavaDoc.zip 文件(对于 JavaSE 7 文档,它应该是 jdk-7u4-apidocs.zip)并重复相同的过程,即 Tools --> Java Platforms --> Javadoc ( tab )然后按“添加压缩/文件夹,并指向解压缩的文件夹而不是压缩的文件夹,重新启动NetBeans,它会顺利直接地工作。

You should download the docs file from the following link: http://www.oracle.com/technetwork/java/javase/documentation/java-se-7-doc-download-435117.html您应该从以下链接下载文档文件: http ://www.oracle.com/technetwork/java/javase/documentation/java-se-7-doc-download-435117.html

After completing the described operation, you will have your javadocs available offline, and you don't need to be connected to the internet to know about APIs.完成所描述的操作后,您将可以离线使用您的 javadocs,并且您无需连接到互联网即可了解 API。

Best regards brother.最好的问候兄弟。

" Tools >> Java Platform >> JavaDoc Tab >> JavaDoc.zip " "工具 >> Java 平台 >> JavaDoc 选项卡 >> JavaDoc.zip "

The problem with above step can be solved easily by moving down following two path already added in content panel as shown below.上述步骤的问题可以通过沿着内容面板中已经添加的两条路径向下移动来轻松解决,如下所示。

Step 1-步骤1-

  • Goto: Tools >> Java Platform >> JavaDoc Tab and Add ZIP/Folder you want to add.转到:工具 >> Java 平台 >> JavaDoc选项卡并添加要添加的 ZIP/文件夹。

Step 2-第2步-

  • 在此处输入图像描述

Step 3-步骤 3-

  • 在此处输入图像描述

That's all and if zip file doesn't works the extract first and then add it.就是这样,如果 zip 文件不起作用,请先提取然后添加它。

I had the same problem, and I solved it by removing all URLs and adding only the apidocs.zip downloaded from oracle.我遇到了同样的问题,我通过删除所有 URL 并仅添加从 oracle 下载的apidocs.zip来解决它。 After that restart your NetBeans.之后重新启动您的 NetBeans。

Before test whether it works be sure the method you are looking for actually exists within the apidocs.在测试它是否有效之前,请确保您正在寻找的方法确实存在于 apidocs 中。 Open index.html and make a search for that particular package.class.method you need.打开index.html并搜索您需要的特定package.class.method

If it doesn't work, try to manually copy the apidoc.zip to the docs directory of netBeans: C:\Program Files\NetBeans 7.1.2\java\docs and then retry.如果不行,尝试手动将apidoc.zip复制到netBeans的docs目录:C:\Program Files\NetBeans 7.1.2\java\docs,然后重试。

这对我有用,我手动将 apidoc.zip 复制到 netBeans 的 docs 目录:C:\Program Files\NetBeans 7.1.2\java\docs 然后重新启动我的 netbeans。

Using a Maven project inside of Netbeans v8.02.在 Netbeans v8.02 中使用Maven项目。

First, view your project via the Projects window;首先,通过Projects窗口查看您的项目;

  • Expand your project's Dependencies folder展开项目的Dependencies文件夹
  • Right-click the desired *.jar file右键单击所需的 *.jar 文件
  • Click download javadoc点击下载javadoc

Done!完毕!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM