<JDK_HOME>\jre\bin\win32com.dll <JDK_HOME>\jre\lib\javax.comm.properties <JDK_HOME>\jre\lib\comm.jar
配置的是这三个
测试代码:
import java.util.Enumeration;import javax.comm.CommPortIdentifier;
public class xx { /**
* @param args
*/
public static void main(String args[]) { Enumeration en = CommPortIdentifier.getPortIdentifiers(); CommPortIdentifier portId; System.out.println("11");
System.out.println(en.toString());
while (en.hasMoreElements()) {
System.out.println("222");
portId = (CommPortIdentifier) en.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL){ System.out.println(portId.getName()); System.out.println("=============");
} } }}
为什么后台只能打印11 为啥检测不到串口呢?!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货