ComExeption
port = (SerialPort) c.open("Terminal", 8000);
System.out.println(c.getCurrentOwner());
is = port.getInputStream();
os = port.getOutputStream();
port.addEventListener(this);
port.notifyOnDataAvailable(true);
try {
port.setSerialPortParams(9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
} catch (UnsupportedCommOperationException e) {}
Thread thread = new Thread(this);
thread.start();
}
catch (PortInUseException e) {
System.out.print(e.currentOwner);
}
catch (IOException e) {
}
catch (TooManyListenersException e) {}
}
public void run() {
try {
Thread.sleep(20000);
} catch (InterruptedException e) {}
}
public void serialEvent(SerialPortEvent arg0) {
switch(arg0.getEventType()){
case SerialPortEvent.BI:
case SerialPortEvent.OE:
case SerialPortEvent.FE:
case SerialPortEvent.PE:
case SerialPortEvent.CD:
case SerialPortEvent.CTS:
case SerialPortEvent.DSR:
case SerialPortEvent.RI:
break;
case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
case SerialPortEvent.DATA_AVAILABLE:
int c;
StringBuffer strb = new StringBuffer();
try {
while (is.available() > 0) {
c=is.read();
strb.append((char)c);
}//End of While loop
//inputStream.close();
} catch (IOException e) {}
}
but i have an exption: javax.comm.PortInUseException: Port currently owned by Unknown Windows Application
how can i solve sthis problem?

