简体   繁体   中英

NoSuchPortException problem for serial port

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 ?

并非所有平台都提供此API的实现。

you need to use rxtx libraries for windows.

http://rxtx.qbang.org/wiki/index.php/FAQ

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM