问题
I am attempting to programmatically generate javadocs via an instance of Runtime
through the exec()
method by passing in the commands necessary to generate javadocs. First of all I am unfamiliar with creating javadocs via the command line and second I am unfamiliar with the exec() method from Runtime
. As a test I was able to execute executables compiled from C# classes through the exec()
command but was not able to do so with executables compiled from C++ classes, what is causing this behavior? Also, I was unable to execute the javadoc.exe file via the exec()
command while pointing to the JDK bin directory. How can I generate javadocs via exec()
arguments, and is it even possible to do so? Thanks.
回答1:
It should certainly be possible to do that.
There are some traps associated with Runtime.exec. For example, if you don't consume the standard error and standard out streams then any executed process will block.
It is also worth noting that not everything you can execute on a console is an executable. System commands like "echo" will not work.
来源:https://stackoverflow.com/questions/3929015/java-runtime-exec-behavior