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.getPort Identifier s();
while(portList.hasMoreElem ents()) {
CommPortIdentifier portId = (CommPortIdentifier)portLi st.nextEle ment();
if( portId.getPortType() ==
CommPortIdentifier.PORT_SE RIAL)
{
System.out.println("Serial port: " +
portId.getName());
} else if (portId.getPortType() ==
CommPortIdentifier.PORT_PA RALLEL)
{
System.out.println("Parall el port: " +
portId.getName());
} else
System.out.println("Other port: " +
portId.getName());
}
}
}
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.getPort
while(portList.hasMoreElem
CommPortIdentifier portId = (CommPortIdentifier)portLi
if( portId.getPortType() ==
CommPortIdentifier.PORT_SE
{
System.out.println("Serial
portId.getName());
} else if (portId.getPortType() ==
CommPortIdentifier.PORT_PA
{
System.out.println("Parall
portId.getName());
} else
System.out.println("Other port: " +
portId.getName());
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thank you for accepting, glad I was of help :)
ASKER
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