Use a command line program from within Java -


how can use command line program within java?

i'm trying pass graph definition in dot-language (see wikipedia) interpreter program dot (see graphviz) through java.

the problem is, program not answer, after have sent dot-graph inputstream, because not know, i'm finished sending description.

this is, have:

package exercise4;  import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.io.printstream; import java.io.unsupportedencodingexception;  public class main {     public static void main(string[] args) {         printstream out = system.out;         bufferedreader in = new bufferedreader(new inputstreamreader(system.in));          try {             final string start =                 "strict graph lsr%1$d {\n" +                 " node [shape=circle color=lightblue style=filled];\n\n" +                 " {rank=same; a--b [label=6];}\n" +                 " {rank=same; c--d [label=12]; d--e [label=4];}\n" +                 " a--c [label=4]; b--d [label=4]; b--e [label=9];\n\n" +                 " node [shape=record color=\"#000000ff\" fillcolor=\"#00000000\"];\n}\n";             process dot = runtime.getruntime().exec("dot -tsvg");             in = new bufferedreader(new inputstreamreader(system.in));             out = new printstream(dot.getoutputstream(), false, "utf-8");             out.printf(start, 0);              out.flush();             out.close();              while(in.ready()) {                 system.out.println(in.readline());             }             in.close();             dot.destroy();         } catch (unsupportedencodingexception ex) {         } catch (ioexception ex) {         } {             out.close();         }     } } 

looks if reading wrong input stream. have @ answer: https://stackoverflow.com/a/4741987/1686330


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -