hi,everyone:
 
 
   Recently ,i found a strange problem.
 
   I wrote a java file to print all the port on the command line. The source code i attached below:

import java.util.*;
import java.io.*;
import javax.comm.*;

public class listenraw {
 public static void main(String argv[]) {
  new listenraw();
 }

 public listenraw() {
  CommPortIdentifier portId;

  Enumeration ports = CommPortIdentifier.getPortIdentifiers();

  if (ports == null) {
   System.out.println("No comm ports found!");
   return;
  }

  // print out all ports
  System.out.println("printing all ports...");
  while (ports.hasMoreElements()) {
   System.out.println("  "
     + ((CommPortIdentifier) ports.nextElement()).getName());

  }
 }
}

The result was :printing all ports...   It meant ports.hasMoreElements() return false.

But from the device manager i found there are COM1 and COM2 occurred.

Can anyone tell me how can i solve the problem.

 

_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to