memory - Bring control from application to java frame -


i use java program communication between arduino board , scratch file. communication happen well. use user interface start communication have buttons called

connect close , minimize

when user clicks connect button code check value in combo box , accordingly opens scratch file.

once connect button clicked control moves scratch application. after completing work when tried closing scratch. scratch application closes expected control not return user interface because of not able close application , close in net beans forcefully. in output screen don't see build successful , instead build stopped. process works until give connect once button pressed hanged where.

i tried making jar file , running in different machine @ time use end task in task manager close application.

private void jbutton1actionperformed(java.awt.event.actionevent evt) {                                           if("disconnect".equals(jbutton1.gettext())) {     system.exit(0); }  if(jcombobox2.getselecteditem()==null) {     system.out.println("select 1 port"); } else {                runtime r = runtime.getruntime();      try {         //this.hide();         //p = r.exec("c:\\program files\\scratch 2\\scratch 2.exe     c:\\users\\admin\\desktop\\fwdbckpwm12.sb2");          p = runtime.getruntime().exec("c:\\program files\\scratch 2\\scratch   2.exe c:\\users\\admin\\desktop\\scratch files new.sb2");          //runtime.getruntime().exec("taskkill /f /im <p>.exe");                     //p.destroy();         //r.exec("c:\\windows\\notepad.exe c:\\windows\\ss.txt");         //this.setdefaultcloseoperation(exit_on_close);          a4s a4sobj = new a4s(new string[] {jcombobox2.getselecteditem().tostring()});  //defaultline          //a4s a4sobj = new a4s(new string[]{"com16"});  //addedline         //r.gc();         //this.setdefaultcloseoperation(exit_on_close);     } catch (ioexception ex) {         logger.getlogger(serialportselection.class.getname()).log(level.severe, null, ex);     }      finally{         //p.destroy();         //system.gc();     // }  }             

here code tried. none seems work.

  1. move process related work separate thread.
  2. use waitfor method recognise process end - free exit app.

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -