Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Serial Port not listing

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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();
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();
CommPortIdentifier cpi = (CommPortIdentifier)numPort.nextElement();
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");
allPorts.append("Port Name : Unknown : \n-->"+cpi+"\n");

Thanks in advance

Author and all-around good cowpoke
Posts: 13078
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is a common problem when using the COMM API.
It is probably due to the 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

Whatever you say buddy! And I believe this tiny ad too:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic