Solved

No output from Port Query using javax.comm

Posted on 2006-07-05
3
254 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
tomcat startup error 5 106
hibernate jars 4 45
ejb on wildfly 5 30
American Express @Work site and Java 4 32
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

821 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