开发者

Java Runtime exec() behavior

开发者 https://www.devze.com 2023-01-19 18:34 出处:网络
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

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 wit开发者_运维百科h 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号