Link libraries to the project

This topic describes how to link the XBee Java Library, the RXTX library (including the native one), and the logger library to the project.

  1. Download the XBJL_X.Y.Z.zip library.
  2. Unzip the XBJL_X.Y.Z.zip library.
  3. Link the libraries using Eclipse or NetBeans:

Option 1: Eclipse

  1. Go to the Libraries tab of the New Java Project window.
  2. Click Add External JARs....
  3. In the JAR Selection window, search the folder where you unzipped the XBee Java Library and open the xbee-java-library-X.Y.Z.jar file.
  4. Click Add External JARs... again.
  5. Go to the extra-libs folder and select the following files:
    • rxtx-2.2.jar

    • slf4j-api-x.y.z.jar

    • slf4j-nop-x.y.z.jar

  6. Expand the rxtx-2.2.jar file of the Libraries tab list, select Native library location, and click Edit….

  7. Click External folder... to navigate to the extra-libs\native\Windows\win32 folder of the directory where you unzipped the XBee Java Library file (XBJL_X.Y.Z.zip).

  8. Replace Windows\win32 with the directory that matches your operating system and the Java Virtual Machine installed (32 or 64 bits). If you don't know which Java Virtual Machine is installed in your computer, open a terminal or command prompt and execute:
    java -version
  9. Click OK to add the path to the native libraries.
  10. Click Finish.

or

Option 2: NetBeans

  1. From Projects view, right-click your project and go to Properties.
  2. In the categories list on the left, go to Libraries and click Add JAR/Folder.
  3. In the Add JAR/Folder window, search the folder where you unzipped the XBee Java Library and open the xbjlib-X.Y.X.jar file.
  4. Click Add JAR/Folder again.
  5. Go to the extra-libs folder and select the following files:
    • rxtx-2.2.jar
    • slf4j-api- x.y.z .jar
    • slf4j-nop- x.y.z .jar
  6. Select Run in the left tree of the Properties dialog.
  7. In the VM Options field, add the following option:
    -Djava.library.path=<path_where_the_XBee_Java_Library_is_unzipped>\extra-libs\native\Windows\win32
    where:
    • <path_where_the_XBee_Java_Library_is_unzipped> is the absolute path of the directory where you unzipped the XBee Java Library file (XBJL_X.Y.Z.zip)
    • Windows\win32 is the directory that matches your operating system and the Java Virtual Machine installed (32 or 64 bits). If you don't know which Java Virtual Machine is installed in your computer, open a terminal or command prompt and execute:
      java -version
  8. Click OK.