com port identification in java
<p>I use the following code to identify the comports. In my system there are three ports but it is showing false in <code>ports.hasMoreElements()</code> method. I also added comm.jar in the library and i am using windows xp (service pack 3). Kindly look into the code and help me.</p>

<pre><code>import java.util.*;
import javax.comm.*;

public class Main
{
    public static void main(String[] args)
    {
        Enumeration ports = CommPortIdentifier.getPortIdentifiers();
        System.out.println(ports.hasMoreElements());
        while(ports.hasMoreElements())
        {
            CommPortIdentifier cpi =
                           (CommPortIdentifier)ports.nextElement();
            System.out.println("Port " + cpi.getName());
        }
    }
}
</code></pre>

<p>Thanks in advance..</p>
