I use the following code to identify the comports. In my system there are three ports but it is showing false in ports.hasMoreElements()
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.
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());
}
}
}
Thanks in advance..