rxtx - Java application won't exit if serial port is left open -


i'm using netbeans make jfx app talks arduino uno. have installed rxtx on 64 bit os x box , seems working.

in main controller of application in initialize() method this:

 commportidentifier  portid = commportidentifier.getportidentifier("/dev/tty.usbmodem1d1111");  this.serialport = (serialport) portid.open("box app", 1000);  // this.serialport.close();  

this great except when close application's window without calling serialport.close() function, app/jvm stays running in background. i've tried overriding dispose() method of controller , adding platform.exit(). platform.setimplicitexit(true); set true, explicitly.

not sure else can do. if user closes app before serial i/o done, apparently hang. how can force port closed when application window closed?

this code:

   topframe.addwindowlistener(new windowlistener()         {             public void windowclosing(windowevent e)             {                 emsclient.close();             }             public void windowopened(windowevent e) {             }             public void windowclosed(windowevent e) {             }             public void windowiconified(windowevent e) {             }             public void windowdeiconified(windowevent e) {             }             public void windowactivated(windowevent e) {             }             public void windowdeactivated(windowevent e) {             }         });` 

will attach event close window


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -