开发者

Calling Graphviz dot from Java

开发者 https://www.devze.com 2023-01-03 09:35 出处:网络
What\'s the best way to call an external p开发者_StackOverflow中文版rogram (graphviz\'s dot in this case) from a Java program and grab the output?You can use the Graphviz Java API class which is a wra

What's the best way to call an external p开发者_StackOverflow中文版rogram (graphviz's dot in this case) from a Java program and grab the output?


You can use the Graphviz Java API class which is a wrapper for Runtime.exec(), this is if you have the dot binaries on the same server as your Java App.

If you don't have dot installed on the server or if you are using an environment like Google AppEngine where you can't install dot binaries locally then you can use Graphviz Server, a lightweight Java based HTTP server, you still need to install the dot binaries on the server on which you run Graphviz Server.


Runtime.exec() and ProcessBuilder do it. You use one of them to create your process, then call its getInputStream to get the output stream of the launched process.

0

精彩评论

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