Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

No output from Port Query using javax.comm

Posted on 2006-07-05
3
Medium Priority
?
278 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 35

Accepted Solution

by:
girionis earned 1000 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

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 functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

610 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