package com.test.www;
import java.util.Enumeration;
public class Hello {
public static void main(String[] args) {
Enumeration<?> en = CommPortIdentifier.getPortIdentifiers();
CommPortIdentifier portId;
while (en.hasMoreElements()) {
portId = (CommPortIdentifier) en.nextElement();
// 如果端口类型是串口,则打印出其端口信息
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
System.out.println(portId.getName());
}
}
}
}
我的comm.jar包已经导入到jre里面去了,为什么还是提示CommPortIdentifier cannot be resolved,求大牛来解决额。。。。。。