java process hangs while launching an executible that is using the file system -
i'm trying execute 'edena' bioinformatic program within java code. process uses input files , write output files. when input files small (~1 mb) process finishes , exits perfectly. when input files larger (~ 80 mb) process hangs. invoking process cmd works fine, suspect got buffers etc.. i'm working on ubuntu 12.04.10 4gb ram (don't know if relevant). code hanging:
string edena_exe1 = "edena -m 75 -p " + workshopdir + binassembly.cliquefilesdir + "clique_" + c.getid() + " -drpairs "+ workshopdir + binassembly.cliquefilesdir + "/clique" + c.getid() + "pair1.fna " + workshopdir + binassembly.cliquefilesdir + "/clique" + c.getid() + "pair2.fna "; process edena_proc1 = runtime.getruntime().exec(edena_exe1); edena_proc1.waitfor();
thanks!
i suspect larger input file process generates more output.
when process started jvm given limited buffered stream output. if not bleed stream while process running may fill , block.
private static void dir() throws ioexception { runtime r = runtime.getruntime(); process p = r.exec("dir c:\\ /s"); bufferedreader br = new bufferedreader(new inputstreamreader(p.getinputstream())); try { string line; // bleed output. while ((line = br.readline()) != null) { system.out.println(line); } } { br.close(); } // in case. p.destroy(); }
Comments
Post a Comment