package test;
import java.io.*;
import java.util.*;
import javax.comm.*;public class SimpleRead {
static CommPortIdentifier portId;
static Enumeration portList; InputStream inputStream;
SerialPort serialPort;
Thread readThread;
static boolean b; public static void main(String[] args) {
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements()) {//无法进入此循环
portId = (CommPortIdentifier) portList.nextElement();
}
}
}我已经将 win32com.dll 放在jdk的bin目录下
将comm.jar和javax.comm.properties文件放在lib目录下
不知道什么原因 无法获得计算机系统的所有串口
请高手指点一二
import java.io.*;
import java.util.*;
import javax.comm.*;public class SimpleRead {
static CommPortIdentifier portId;
static Enumeration portList; InputStream inputStream;
SerialPort serialPort;
Thread readThread;
static boolean b; public static void main(String[] args) {
portList = CommPortIdentifier.getPortIdentifiers();
while (portList.hasMoreElements()) {//无法进入此循环
portId = (CommPortIdentifier) portList.nextElement();
}
}
}我已经将 win32com.dll 放在jdk的bin目录下
将comm.jar和javax.comm.properties文件放在lib目录下
不知道什么原因 无法获得计算机系统的所有串口
请高手指点一二
将comm.jar放在jdk裡jre的lib內ext目錄下
javax.comm.properties文件放jdk的jre內lib目录下再將win32com.dll放在jre的bin目录下
将comm.jar放在jre的lib内ext目錄下
javax.comm.properties文件放在jre的lib目录下