title: java.lang.UnsatisfiedLinkError: no usbJava in java.library.path
body: <p>I am trying to connect to my arduino with Java and OSx yosemite, but am getting the following error:</p>
  
  <pre><code>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.&lt;clinit&gt;(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)
  </code></pre>
  
  <p>This is the code I'm executing:</p>
  
  <pre><code>public static void main(String[] args) {
          try {
              Link link = Link.getDefaultInstance();
              link = getDigisparkConnection(); // Comment this row if you use just the default connection
  
              List&lt;String&gt; portList = link.getPortList();
              if(portList != null &amp;&amp; portList.size() &gt; 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&lt;String&gt; 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()));
      }
  </code></pre>
  
  <p>When I comment the 4th line (link = getDigisparkConnection();), I get the following error:</p>
  
  <pre><code>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.&lt;clinit&gt;(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)
  </code></pre>
  
  <p>That has something to do with the native rxtx lib but I am not being able to solve it. I am using IntelliJ IDEA as IDE. Looking for this error, I've only found linux answers, but nothing regarding OSX.
  Thanks</p>