CommPortIdentifier incorrectly lists available COM ports

Discussion in 'Java' started by John, Nov 9, 2006.

  1. John

    John Guest

    I have some code (in an OSGi bundle) which uses a CommPortIdentifier
    object to enumerate the available COM ports on a Windows XP system
    (Dell Latitude laptop).
    With portList being an Enumeration object, it sets:
    portList = CommPortIdentifier.getPortIdentifiers();

    When the code next calls 'portList.hasMoreElements(),' the method
    returns 'false,' even though there clearly is a COM1 port which I can
    observe in action using HyperTerminal (HyperTerm is closed when running
    the Java code).

    The strange thing is that this code has been known to work on this same
    machine in the past. One day the behavior changed and I can't figure
    out why...any suggestions would be greatly appreciated.
    John, Nov 9, 2006
    #1
    1. Advertising

  2. John

    John Guest

    I should add that after reviewing posts on this topic, I found that the
    file javax.comm.properties was in the c:\jre1.5.0_06\lib directory on
    my desktop but absent on my laptop...this must be the problem, right?
    I copied the file over, rebooted, and the problem persists.
    Does anyone know whether I need to install the fullblown Java SDK
    rather than just the skeleton JRE?

    On Nov 9, 10:58 am, "John" <> wrote:
    > I have some code (in an OSGi bundle) which uses aCommPortIdentifier
    > object to enumerate the available COM ports on a Windows XP system
    > (Dell Latitude laptop).
    > With portList being an Enumeration object, it sets:
    > portList =CommPortIdentifier.getPortIdentifiers();
    >
    > When the code next calls 'portList.hasMoreElements(),' the method
    > returns 'false,' even though there clearly is a COM1 port which I can
    > observe in action using HyperTerminal (HyperTerm is closed when running
    > the Java code).
    >
    > The strange thing is that this code has been known to work on this same
    > machine in the past. One day the behavior changed and I can't figure
    > out why...any suggestions would be greatly appreciated.
    John, Nov 9, 2006
    #2
    1. Advertising

  3. John wrote:
    > I should add that after reviewing posts on this topic, I found that the
    > file javax.comm.properties was in the c:\jre1.5.0_06\lib directory on
    > my desktop but absent on my laptop...this must be the problem, right?
    > I copied the file over, rebooted, and the problem persists.
    > Does anyone know whether I need to install the fullblown Java SDK
    > rather than just the skeleton JRE?
    >
    > On Nov 9, 10:58 am, "John" <> wrote:
    >> I have some code (in an OSGi bundle) which uses aCommPortIdentifier
    >> object to enumerate the available COM ports on a Windows XP system
    >> (Dell Latitude laptop).
    >> With portList being an Enumeration object, it sets:
    >> portList =CommPortIdentifier.getPortIdentifiers();
    >>
    >> When the code next calls 'portList.hasMoreElements(),' the method
    >> returns 'false,' even though there clearly is a COM1 port which I can
    >> observe in action using HyperTerminal (HyperTerm is closed when running
    >> the Java code).
    >>
    >> The strange thing is that this code has been known to work on this same
    >> machine in the past. One day the behavior changed and I can't figure
    >> out why...any suggestions would be greatly appreciated.

    >


    You don't need the JDK. There are three files, comm.jar which goes into
    the JRE/lib/ext directory, javax.comm.properties which goes into the
    JRE/lib directory and win32com.dll which goes into the JRE/bin
    directory. Some operating systems report more ports than actually exist
    but under reporting is usually an installation or coding problem.

    --

    Knute Johnson
    email s/nospam/knute/
    Knute Johnson, Nov 9, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Galina Grechka
    Replies:
    3
    Views:
    340
    Galina Grechka
    Jan 19, 2005
  2. Peter Strøiman
    Replies:
    1
    Views:
    2,072
    Peter Strøiman
    Aug 23, 2005
  3. Nathan Sokalski

    SelectedIndex Value Reported Incorrectly

    Nathan Sokalski, Oct 3, 2005, in forum: ASP .Net
    Replies:
    6
    Views:
    523
    Nathan Sokalski
    Oct 6, 2005
  4. =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==

    List of lists of lists of lists...

    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==, May 8, 2006, in forum: Python
    Replies:
    5
    Views:
    391
    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==
    May 15, 2006
  5. mreister
    Replies:
    1
    Views:
    3,122
    mreister
    May 25, 2010
Loading...

Share This Page