Ports are not listed using RXTX
<p>I want to connect to the USB MODEM using serial port API. So the following code I have used, even though USB MODEM is connected, It is not listing.</p>

<p>I am working in fedora, installed RXTX library, but the problem is there..please help me.</p>

<pre><code>import java.io.*;
import java.util.*;
import gnu.io.*;


public class SimpleWrite {

static Enumeration portList;
static CommPortIdentifier portId;
static String messageString = "Hello, world!\n";
static SerialPort serialPort;
static OutputStream outputStream;

public static void main(String[] args) throws NoSuchPortException {

    portList = CommPortIdentifier.getPortIdentifiers();
    //System.out.println("JVM Version: " +System.getProperty("java.runtime.version"));
    System.out.println(portList.hasMoreElements()); //portList.hasMoreElements()
    //portList.hasMoreElements()
    while (portList.hasMoreElements()) {
        portId = (CommPortIdentifier) portList.nextElement();

        if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
// if (portId.getName().equals("COM1")) {
            if (portId.getName().equals("/dev/ttyUSB0")) {
                try {
                    serialPort = (SerialPort) portId.open("SimpleWriteApp", 2000);
                } catch (PortInUseException e) {
                }
                try {
                    outputStream = serialPort.getOutputStream();
                } catch (IOException e) {
                }
                try {
                    serialPort.setSerialPortParams(9600,
                            SerialPort.DATABITS_8,
                            SerialPort.STOPBITS_1,
                            SerialPort.PARITY_NONE);
                } catch (UnsupportedCommOperationException e) {
                }
                try {
                    outputStream.write(messageString.getBytes());
                } catch (IOException e) {
                }
            }
        }
    }
}
}
</code></pre>

<p>the main problem is " portList.hasMoreElements() is returning <strong>false</strong> "</p>

<p>thanking you</p>
