Java runtime issue from Swing application -


i have 1 swing application executing 1 jar file, processing internally. process have below: 1. 1 java file main() loads swing gui. gui can browse , load required jar files execute.

public static void main(string[] args) {     javax.swing.swingutilities.invokelater(new runnable() {         public void run() {             migrationprocesselementdialog.createandshowgui();          }     });  } 
  1. from swing application loading jar file as:

runtime rt = runtime.getruntime();    // replacepath path of jar file loaded. process proc = rt.exec("java -jar " + replacepath);    int exitval = proc.waitfor(); 
  1. when trigger execution, task manager seeing, 2 javaw.exe (one eclipse, 1 swing gui) , 1 java.exe program flow. program flow continues few times (evident log update) stuck after time.

  2. as as, kill swing gui javaw.exe; program flow starts , continues rest of part promptly. seems me somehow javaw.exe blocking java.exe execution. @ possible? what's resolution of it?

if execute, process executable jar command prompt using normal java -jar "path" command, program flow not stuck, it's working expected.

only facing problem when executing gui or using runtime. used processbuilder also; faced same problem.

if 1 can please give me clue helpful. thanks!

you should handle output of process (both of stdout, stderr ). because, these outputs redirected parent process through 3 streams (getoutputstream(), getinputstream(), geterrorstream() ). if not handled, block when child process produces output.

process documentation

some native platforms provide limited buffer size standard input , output streams, failure promptly write input stream or read output stream of subprocess may cause subprocess block, , deadlock.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -