• Post Reply Bookmark Topic Watch Topic
  • New Topic

Serial Port not listing  RSS feed

 
Jagadeesh Sankaran
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Im working on a COM port reading program. Im using windows 2000 professional. But when it runs , it does not return any port listings.
Im using the method
Enumeration r=CommPortIdentifier.getPortIdentifiers();
but,
while(r.hasMoreElements()) returns false.
what it could be problem. The COM ports are not showing any conflicts in the system properties.
Please see the following code snippet ,that im using.

Enumeration numPort = CommPortIdentifier.getPortIdentifiers();
while(numPort.hasMoreElements()){
CommPortIdentifier cpi = (CommPortIdentifier)numPort.nextElement();
if(cpi.getPortType()==CommPortIdentifier.PORT_PARALLEL){
allPorts.append("Port Name : "+cpi.getName()+" is Parallel : \n-->"+cpi+"\n");
}else if(cpi.getPortType()==CommPortIdentifier.PORT_SERIAL){
allPorts.append("Port Name : "+cpi.getName()+" is Serial : \n-->"+cpi+"\n");
}else{
allPorts.append("Port Name : Unknown : \n-->"+cpi+"\n");
}
******

Thanks in advance

Jagadeesh
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is a common problem when using the COMM API.
It is probably due to the javax.comm.properties file - which defines the driver class to be used - not being found by the library.
Why Sun couldn't manage to test for Windows and use the appropriate driver is beyond me.
As I recall, that properties file needs to be in the
JAVA_HOME\jre\lib directory

Bill
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!