serial - java.lang.UnsatisfiedLinkError: no usbJava en java.library.path
rxtx java arduino (0)
Estoy intentando conectarme a mi arduino con Java y OSx yosemite, pero estoy obteniendo el siguiente error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no usbJava in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1865)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at ch.ntb.usb.LibusbJava.<clinit>(LibusbJava.java:366)
at ch.ntb.usb.USB.init(USB.java:315)
at org.zu.ardulink.connection.usb.DigisparkUSBConnection.getPortList(DigisparkUSBConnection.java:116)
at org.zu.ardulink.Link.getPortList(Link.java:217)
at BlinkLED.main(BlinkLED.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Este es el código que estoy ejecutando:
public static void main(String[] args) {
try {
Link link = Link.getDefaultInstance();
link = getDigisparkConnection(); // Comment this row if you use just the default connection
List<String> portList = link.getPortList();
if(portList != null && portList.size() > 0) {
String port = portList.get(0);
System.out.println("Connecting on port: " + port);
boolean connected = link.connect(port);
System.out.println("Connected:" + connected);
Thread.sleep(2000);
int power = IProtocol.HIGH;
while(true) {
System.out.println("Send power:" + power);
link.sendPowerPinSwitch(2, power);
if(power == IProtocol.HIGH) {
power = IProtocol.LOW;
} else {
power = IProtocol.HIGH;
}
Thread.sleep(2000);
}
} else {
System.out.println("No port found!");
}
}
catch(Exception e) {
e.printStackTrace();
}
}
private static Link getDigisparkConnection() {
Set<String> protocolNames = ProtocolHandler.getInstalledProtocolImplementationNames();
SimpleBinaryProtocol protocol = new SimpleBinaryProtocol();
if(!protocolNames.contains(SimpleBinaryProtocol.NAME)) {
ProtocolHandler.installProtocolImplementation(protocol);
}
return Link.createInstance("digisparkConnection", SimpleBinaryProtocol.NAME, new DigisparkUSBConnection("digisparkConnection", protocol.getIncomingMessageDivider()));
}
Cuando comento la cuarta línea (link = getDigisparkConnection ();), aparece el siguiente error:
java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading gnu.io.RXTXCommDriver
Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1865)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:83)
at org.zu.ardulink.connection.serial.SerialConnection.connect(SerialConnection.java:161)
at org.zu.ardulink.connection.serial.SerialConnection.connect(SerialConnection.java:139)
at org.zu.ardulink.connection.serial.SerialConnection.connect(SerialConnection.java:227)
at org.zu.ardulink.Link.connect(Link.java:187)
at BlinkLED.main(BlinkLED.java:37)
Eso tiene algo que ver con la rxtx lib nativa, pero no puedo resolverlo. Estoy usando IntelliJ IDEA como IDE. Buscando este error, solo encontré las respuestas de Linux, pero nada con respecto a OSX. Gracias