NeuronRobotics / nrjavaserial

A Java Serial Port system. This is a fork of the RXTX project that uses in jar loading of the native code.
Other
345 stars 143 forks source link

Nrjavaserial doesn't work in MAC #88

Closed joseluisUEX closed 4 years ago

joseluisUEX commented 7 years ago

I´ve used the library nrjavaserial-3.12.0.jar in my Mac (OS X 10.9.3) and the connection doesn't work. However, ports are detected using the following code:

   try{
        Enumeration<CommPortIdentifier> ports = CommPortIdentifier.getPortIdentifiers();
        while(ports.hasMoreElements())
            System.out.println(ports.nextElement().getName());
    }catch(Exception ex){
        ex.printStackTrace();
    }catch(Error er){
        er.printStackTrace();
    }

But when the program runs the following instruction

serialPort = (SerialPort) portId.open(this.getClass().getName(),TIME_OUT);

The program returns an error.

If I change this library adding RXTXcomm-2.jar library instead, the program runs fine. So I suppose the problem is nrjavaserial library.

As we want the program runs in every system, we'd like to use nrjavaserial library. Does anybody know which is the problem?

MrDOS commented 7 years ago

The program returns an error.

Can you provide the error here?

joseluisUEX commented 7 years ago

This is the message returned:

Exception in thread "main" java.lang.NoSuchMethodError: gnu.io.CommPortIdentifier.open(Ljava/lang/String;I)Lgnu/io/RXTXPort; at ConexionCOM.abrirConexion(ConexionCOM.java:94) at TestConexion.conectar(TestConexion.java:51) at TestConexion.main(TestConexion.java:21) Experimental: JNI_OnLoad called.

madhephaestus commented 4 years ago

this is dependant on #163

madhephaestus commented 4 years ago

check 5.0.0