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. Advertisements

  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. Advertisements

  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. Advertisements

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. JustSomeGuy

    Sorting lists of lists...

    JustSomeGuy, Jun 17, 2004, in forum: C++
    Replies:
    0
    Views:
    484
    JustSomeGuy
    Jun 17, 2004
  2. Jon Slaughter

    lists of lists

    Jon Slaughter, Dec 13, 2004, in forum: C++
    Replies:
    4
    Views:
    673
    Buster
    Dec 13, 2004
  3. Charlotte Henkle

    Counter for items in lists in lists?

    Charlotte Henkle, Sep 25, 2004, in forum: Python
    Replies:
    8
    Views:
    625
    Charlotte Henkle
    Sep 26, 2004
  4. robin
    Replies:
    10
    Views:
    675
    Dave Hansen
    Apr 12, 2006
  5. =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==

    List of lists of lists of lists...

    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==, May 8, 2006, in forum: Python
    Replies:
    5
    Views:
    708
    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==
    May 15, 2006
  6. yomgui

    list of lists of lists ....

    yomgui, Jul 28, 2006, in forum: Python
    Replies:
    6
    Views:
    555
    yomgui
    Jul 31, 2006
  7. Daniel Nogradi
    Replies:
    3
    Views:
    526
    Dennis Lee Bieber
    Nov 10, 2006
  8. mreister
    Replies:
    1
    Views:
    5,094
    mreister
    May 25, 2010
Loading...