java - wait the end of the execution of a process -


in code i'm trying convert file mdl file xml using simex tool. use xml file analysis. when convert file manually or if treat small model (via process....) ,no error has been occured.

the problem when try convert big model via process using code :

if(!(xmlfile.exists())) {process child;      child = runtime.getruntime().exec("cmd.exe /c start /min "+system.getproperty("user.dir")+"\\simex\\mdltoxml.bat "+path+" "+xmlpath+" " +system.getproperty("user.dir")+"\\simex\\",null,null);      try {         child.waitfor();     } catch (interruptedexception e) {         e.printstacktrace();     } 

this code work small model ,so think problem that's project analyse xml file before end of transformation because error : exception in thread "main" org.jdom2.input.jdomparseexeception:error on line of document file (......xml):fin prématurée du fichier............

so want know how can wait end of transformation execute second part of analyse of xml file.

nb: have tried put

child.getinputstream().close(); child.getoutputstream().close(); 

before child.waitfor();

somaya.

i think it's same issue discussed here: runtime.exec().waitfor() doesn't wait until process done

remove start parameter run shell in foreground not in background mode, java waits it.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -