如何从命令行生成 Javadoc
谁能告诉我如何从命令行生成 Javadoc?
我的项目包含 com.test
包,我想将生成的文档放入特定文件夹中的文件中,如下所示:C:/javadoc/test
。
Can anybody show me how to generate Javadoc from command line?
My project contains the package com.test
and I want to put the generated documentation in files located in a specific folder like this: C:/javadoc/test
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
您可以参考 javadoc 8 文档
我认为 你所看到的是这样的:
You can refer the javadoc 8 documentation
I think what you are looking at is something like this:
Oracle 提供了一些简单的示例:
http://docs .oracle.com/javase/8/docs/technotes/tools/windows/javadoc.html#CHDJBGFC
假设您位于 ~/ 并且 java 源代码树位于 ./saxon_source/net 中并且您想要递归通过整个源树网络既是一个目录又是顶级包名称。
Oracle provides some simple examples:
http://docs.oracle.com/javase/8/docs/technotes/tools/windows/javadoc.html#CHDJBGFC
Assuming you are in ~/ and the java source tree is in ./saxon_source/net and you want to recurse through the whole source tree net is both a directory and the top package name.
假设您有以下目录结构,您希望在
file1.java
和file2.java
(包 com.test)上生成 javadoc,并将 javadocs 放置在 < code>C:\javadoc\test:在命令终端中,导航到包的根目录:
C:\projects
。如果您只想在项目内的所有 java 文件上生成标准 javadoc,请运行以下命令(对于多个包,用空格分隔包名称):如果您想从其他地方运行 javadocs,则需要指定源路径。例如,如果您要在
C:\
中运行 javadocs,则可以按如下方式修改命令:如果您想仅在选定的 .java 文件上运行 javadocs,则添加用 分隔的源文件名空格(您可以使用星号 (*) 作为通配符)。确保包含文件的路径:
可以找到更多信息/方案 此处。
Let's say you have the following directory structure where you want to generate javadocs on
file1.java
andfile2.java
(package com.test), with the javadocs being placed inC:\javadoc\test
:In the command terminal, navigate to the root of your package:
C:\projects
. If you just want to generate the standard javadocs on all the java files inside the project, run the following command (for multiple packages, separate the package names by spaces):If you want to run javadocs from elsewhere, you'll need to specify the sourcepath. For example, if you were to run javadocs in in
C:\
, you would modify the command as such:If you want to run javadocs on only selected .java files, then add the source filenames separated by spaces (you can use an asterisk (*) for a wildcard). Make sure to include the path to the files:
More information/scenarios can be found here.
例如,如果我有一个如下所示的应用程序源代码结构:
然后我会做:
这应该为 com 包的源代码和所有子包(递归地)创建 javadoc,在“C:\b2b”目录中找到。
For example if I had an application source code structure that looked like this:
Then I would do:
And that should create javadocs for source code of the com package, and all subpackages (recursively), found inside the "C:\b2b" directory.
很简单,转到保存所有 java 代码的文件夹,例如 E:/javaFolder,然后
javadoc *.java
示例
E:\javaFolder> javadoc *.java
its simple go to the folder where your all java code is saved say E:/javaFolder and then
javadoc *.java
example
E:\javaFolder> javadoc *.java
如果必须处理多个sourcepath和子包,给出的答案并不完全完整。
以下命令行将处理位于 /home/rudy/IdeaProjects/demo/src/main/java 和 com 和 LOR(指环王)下的所有包/home/rudy/IdeaProjects/demo/src/test/java/
请注意:
The answers given were not totally complete if multiple sourcepath and subpackages have to be processed.
The following command line will process all the packages under com and LOR (lord of the rings) located into /home/rudy/IdeaProjects/demo/src/main/java and /home/rudy/IdeaProjects/demo/src/test/java/
Please note:
如果你想创建 lang 包的停靠文件,那么路径应该与你的 lang 包当前所在的路径相同。例如,我创建了一个名为
javaapi
的文件夹并解压缩src
zip 文件,然后使用以下命令。If you want to create dock file of lang package then path should be same where your lang package is currently. For example, I created a folder name
javaapi
and unzipped thesrc
zip file, then used the command below.JavaDoc 链接
我相信这肯定会有所帮助你。
Link to JavaDoc
I believe this will surely help you.