简体   繁体   中英

Processing: UnsatisfiedLinkError when running getPortIdentifiers();

I'm adapting this sketch for use with a serial based thermal printer.

While declaring an object, a connect function is run, and specifically the

Enumeration<?> portEnum = CommPortIdentifier.getPortIdentifiers();

is generating this error:

java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver

Here's the start of the connect function:

 private void connect() {


                    CommPortIdentifier portId = null;


        Enumeration<?> portEnum = CommPortIdentifier.getPortIdentifiers();

        // iterate through, looking for the port
        while (portEnum.hasMoreElements()) {
          CommPortIdentifier currPortId = (CommPortIdentifier) portEnum.nextElement();
          for (String portName : PORT_NAMES) {
            if (currPortId.getName().equals(portName)) {
              portId = currPortId;
              break;
            }
          }
        }


        if (portId == null) {
          System.out.println("Could not find COM port.");
          return;
        }

Does anyone know how to fix this? I've researched the error message, and the only results that come up imply a 32-bit issue, which seems to have been resolved many versions of Processing ago. Other solutions people have suggestion have been specific to the Windows and Linux platforms.

I'm on a Mac running 64-bit Processing.

Thank you very much!

Sorted it. The serial processing library comes with libjSSC-2.6.jnilib and this older library was looking for librxtxSerial.jnilib , which I grabbed here .

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