Identificación de puerto serie con java en ubuntu

Estoy tratando de conectar una aplicación serie en Ubuntu con Java
Después de buscar y leer recursos, agrego comm.jar y RXTXcomm.jar en la biblioteca.
Utilizo el siguiente código para identificar los comports. En mi sistema hay tres puertos pero se muestra falso enports.hasMoreElements() método.
Por favor, mira el código y ayúdame.

String wantedPortName = "/dev/ttya";
///dev/ttyS0 و /dev/ttyS1 نیز تست شد
Enumeration portIdentifiers = CommPortIdentifier.getPortIdentifiers();
CommPortIdentifier portId = null;  // will be set if port found
while (portIdentifiers.hasMoreElements())
{
    CommPortIdentifier pid = (CommPortIdentifier) portIdentifiers.nextElement();
    if(pid.getPortType() == CommPortIdentifier.PORT_SERIAL &&
      pid.getName().equals(wantedPortName)) 
  {
    portId = pid;
    break;
  }
}
if(portId == null)
{
     System.err.println("Could not find serial port " + wantedPortName);
     System.exit(1);
}    

Respuestas a la pregunta(2)

Su respuesta a la pregunta