首页 > 代码库 > 构造graphviz

构造graphviz

public constructGraphviz(String InputPath, String OutputPath) throws IOException, InterruptedException
      {
            
             String dotPath = new String ();
            
            
            dotPath = GraphVizConfigure. ConfiAdd();
             String fileInputPath = InputPath;//输入为.txt的源文件
             String fileOutputPath = OutputPath;//输出为.jpg文件
             String tParam = "-Tjpg";
             String tOParam = "-o";
             String[] cmd = new String [5];
            cmd[0] = dotPath;
            cmd[1] = tParam;
            cmd[2] = fileInputPath;
            cmd[3] = tOParam;
            cmd[4] = fileOutputPath;
            Runtime rt = Runtime. getRuntime();
            rt.exec(cmd);
            Thread. sleep(600L);//注意此步骤很关键需要一个timer的缓冲 否则读取文件错误
      }
You can also reference:http://bitsy.googlecode.com/svn/trunk/Itsybitsy/src/arbolB/ArbolB.java