2

In my project I have an rxtx library that I use to manage Serial comms. When I run the application in netbeans ide I have no problems. I have put the rxtx files in my java folders and added the path in the project libraries. The problems start when I build the jar file for the project. It creates the jar file and adds the folder for costum libraries at /lib folder. However I am not able to run the jar file by double clicking on it. When I run it from command line I get:

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

What should I do in order for the program be able to find the rxtx library in the /lib folder?

Charles
  • 50,943
  • 13
  • 104
  • 142
xnonamex
  • 405
  • 2
  • 5
  • 17
  • What does your command line command look like? – rmlan Aug 14 '13 at 21:36
  • Finally found a solution to this myself: http://stackoverflow.com/questions/14596406/java-rxtx-and-packaging/16716867#16716867 the problem is that it does not take the dll file. so you need to manually put it in the /dist folder. Hope this helps to ppl :) – xnonamex Aug 15 '13 at 19:45

3 Answers3

0

You must either:

  1. Provide the classpath containing your /lib when you run java from the command line. Use the -cp option to do this.
  2. Properly create an executable jar that bundles your /lib. I use maven and this plugin to create that: https://code.google.com/p/onejar-maven-plugin/
Category6
  • 516
  • 5
  • 19
0

When you execute the program from the command line, you will need to specify the java.library.path to make sure that your native libraries are accessible by the JVM.

Without knowing how you actually run your program, I am going to take a guess at what the command should look something like:

java -cp yourjar.jar -Djava.library.path=/yourProjectPath/lib gnu.io.RXTXCommDriver
rmlan
  • 4,387
  • 2
  • 21
  • 28
0

You can extract the required libraries into the jar file (when you don't want to use command line). Checkout this site to make this happen at netbeans.