串口的NoSuchPortException问题
我尝试使用 (Windows XP) javax.comm 库和这段代码连接到 SerialPort COM6
portId = CommPortIdentifier.getPortIdentifier(commName);
port = portId.open("", Integer.parseInt(timeout));
serialPort = (SerialPort) port;
serialPort.setSerialPortParams(Integer.parseInt(baudRate), SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
,但出现异常 NoSuchPortException 和错误
Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no SolarisSerialParallel in java.library.path
Caught java.lang.UnsatisfiedLinkError: com.sun.comm.SolarisDriver.readRegistrySerial(Ljava/util/Vector;Ljava/lang/String;)I while loading driver com.sun.comm.SolarisDriver
Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no SolarisSerialParallel in java.library.path
这是什么问题?有人可以帮忙吗?
I tried to connect to SerialPort COM6 using (Windows XP) javax.comm library with this piece of code
portId = CommPortIdentifier.getPortIdentifier(commName);
port = portId.open("", Integer.parseInt(timeout));
serialPort = (SerialPort) port;
serialPort.setSerialPortParams(Integer.parseInt(baudRate), SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
but I got exception NoSuchPortException and error
Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no SolarisSerialParallel in java.library.path
Caught java.lang.UnsatisfiedLinkError: com.sun.comm.SolarisDriver.readRegistrySerial(Ljava/util/Vector;Ljava/lang/String;)I while loading driver com.sun.comm.SolarisDriver
Error loading SolarisSerial: java.lang.UnsatisfiedLinkError: no SolarisSerialParallel in java.library.path
What is wrong with this ? Can anybody please help ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此 API 的实现并非在所有平台上均可用。
The implementation of this API is not available on all platforms.
您需要使用 Windows 的 rxtx 库。
http://rxtx.qbang.org/wiki/index.php/FAQ
you need to use rxtx libraries for windows.
http://rxtx.qbang.org/wiki/index.php/FAQ