Link to home
Start Free TrialLog in
Avatar of stevebeech
stevebeech

asked on

No output from Port Query using javax.comm

I've installed javax.comm package (version 2.0) under Win XP.
I compile and run the following code but don't get any output.
Can anyone tell me why?

Cheers,
Steve

import javax.comm.*;
import java.util.*;

public class PortList
{
  public static void main(String [] args)
  {
       Enumeration portList = CommPortIdentifier.getPortIdentifiers();

          while(portList.hasMoreElements()) {
        CommPortIdentifier portId = (CommPortIdentifier)portList.nextElement();
      if( portId.getPortType() ==
                  CommPortIdentifier.PORT_SERIAL)
        {
          System.out.println("Serial port: " +
                                   portId.getName());
         } else if (portId.getPortType() ==
                     CommPortIdentifier.PORT_PARALLEL)
           {
            System.out.println("Parallel port: " +
                                     portId.getName());
           } else
             System.out.println("Other port: " +
                                      portId.getName());
          }
    }
}
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of stevebeech
stevebeech

ASKER

Thanks Girionis!

I'd registered the commpackage correctly with the JDK, but hadn't copied the .dll and .props file into the JRE folders. It really ought to mention this in the installation instructions for the comm package.

Thanks for your (ever-so-quick) response.

Steve
Thank you for accepting, glad I was of help :)