Solved

No output from Port Query using javax.comm

Posted on 2006-07-05
3
238 Views
Last Modified: 2010-03-31
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.getPortIdentifiers();

          while(portList.hasMoreElements()) {
        CommPortIdentifier portId = (CommPortIdentifier)portList.nextElement();
      if( portId.getPortType() ==
                  CommPortIdentifier.PORT_SERIAL)
        {
          System.out.println("Serial port: " +
                                   portId.getName());
         } else if (portId.getPortType() ==
                     CommPortIdentifier.PORT_PARALLEL)
           {
            System.out.println("Parallel port: " +
                                     portId.getName());
           } else
             System.out.println("Other port: " +
                                      portId.getName());
          }
    }
}
0
Comment
Question by:stevebeech
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
girionis earned 250 total points
ID: 17042277
Have you registered the comm package and installed the configuration files properly? Have a look here: http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21906501.html
0
 

Author Comment

by:stevebeech
ID: 17042316
Thanks Girionis!

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
0
 
LVL 35

Expert Comment

by:girionis
ID: 17042367
Thank you for accepting, glad I was of help :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
topping2 challenge 13 83
AWS and Java and Rest - newbie question (Is this an authentication issue) 4 68
github account with ecipse 1 42
MySQL  on Tomcat 8 31
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now