Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » java.library.path issues with external library
java.library.path issues with external library [message #223730] Mon, 06 February 2006 22:56 Go to next message
Eclipse User
Originally posted by: me2.nowhere.com

I am building my first swt app that uses an external library. I am trying
to use rxtx (http://www.rxtx.org/) to facilitate serial communications
from my Java application.

My app worked fine until I added the rxtx stuff. I added the necessary
imports and it builds fine. In Properties->JavaBuildPath->Order and
Export, I added RXTXcomm.jar.

When I run the application, I get:
java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown
while loading gnu.io.RXTXCommDriver

So, I add -Djava.library.path=/usr/java/jre1.5.0_05/lib/i386 to
Run...<RunID>->WM Arguments.

Then when I run the application I get:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no
swt-pi-gtk-3139 in java.library.path

How do I get both libraries to load at run time ?

Thanks.
Re: java.library.path issues with external library [message #223738 is a reply to message #223730] Mon, 06 February 2006 23:30 Go to previous messageGo to next message
Eclipse User
Originally posted by: me2.nowhere.com

I found the file libswt-pi-gtk-3139.so in /usr/lib.

I tried -Djava.library.path=/usr/java/jre1.5.0_05/lib/i386;/usr/lib with
no joy.

-Djava.library.path=/usr/java/jre1.5.0_05/lib/i386:/usr/lib and it seems
to have worked.
Re: java.library.path issues with external library [message #223779 is a reply to message #223730] Tue, 07 February 2006 08:18 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

When you get to your jar in the build path, you can also expand the jar
and add a native library entry that points to the correct native library
dir for that jar ... then eclipse will automatically compute the
java.library.path for you.

Later,
PW


Re: java.library.path issues with external library [message #223793 is a reply to message #223730] Tue, 07 February 2006 09:40 Go to previous messageGo to next message
Michael is currently offline Michael
Messages: 40
Registered: July 2009
Member
Hello,

I think this problem is not because of the jar files. Both of the
libraries try to load a dll. Please check that the dlls can be found in
the search path. The easiest way to check this is to copy them to the
windows system32 folder. If this source of the problem you can try further
to adjust your paths.

HTH,
Michael

On Mon, 06 Feb 2006 20:56:00 -0700, me2 wrote:

>
> I am building my first swt app that uses an external library. I am trying
> to use rxtx (http://www.rxtx.org/) to facilitate serial communications
> from my Java application.
>
> My app worked fine until I added the rxtx stuff. I added the necessary
> imports and it builds fine. In Properties->JavaBuildPath->Order and
> Export, I added RXTXcomm.jar.
>
> When I run the application, I get:
> java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown
> while loading gnu.io.RXTXCommDriver
>
> So, I add -Djava.library.path=/usr/java/jre1.5.0_05/lib/i386 to
> Run...<RunID>->WM Arguments.
>
> Then when I run the application I get:
> Exception in thread "main" java.lang.UnsatisfiedLinkError: no
> swt-pi-gtk-3139 in java.library.path
>
> How do I get both libraries to load at run time ?
>
> Thanks.
Re: java.library.path issues with external library [message #223844 is a reply to message #223779] Tue, 07 February 2006 19:11 Go to previous messageGo to next message
Eclipse User
Originally posted by: me2.nowhere.com

On Tue, 07 Feb 2006 08:18:06 -0500, Paul Webster wrote:

> When you get to your jar in the build path, you can also expand the jar
> and add a native library entry that points to the correct native library
> dir for that jar ... then eclipse will automatically compute the
> java.library.path for you.
>
> Later,
> PW


Thanks. I'll give that a try too.
Re: java.library.path issues with external library [message #223850 is a reply to message #223793] Tue, 07 February 2006 19:20 Go to previous messageGo to next message
Eclipse User
Originally posted by: me2.nowhere.com

On Tue, 07 Feb 2006 15:40:03 +0100, michael wrote:

> Hello,
>
> I think this problem is not because of the jar files. Both of the
> libraries try to load a dll. Please check that the dlls can be found in
> the search path. The easiest way to check this is to copy them to the
> windows system32 folder. If this source of the problem you can try further
> to adjust your paths.
>
> HTH,
> Michael


Err... I'm running Linux...
Re: java.library.path issues with external library [message #223878 is a reply to message #223850] Wed, 08 February 2006 09:12 Go to previous messageGo to next message
Michael is currently offline Michael
Messages: 40
Registered: July 2009
Member
Then it'll be a shared lib and your $PATH... ;)

> Err... I'm running Linux...
Re: java.library.path issues with external library [message #223885 is a reply to message #223850] Wed, 08 February 2006 09:49 Go to previous messageGo to next message
Michael is currently offline Michael
Messages: 40
Registered: July 2009
Member
Now I just tried it...
rxtx stuff is relative to source code

Sample code:
----------------------------------------
import gnu.io.*;
import java.util.*;

class ShowPorts {
public static void main(String[] args) {
CommPortIdentifier portId;
Enumeration en = CommPortIdentifier.getPortIdentifiers();
while (en.hasMoreElements()) {
portId = (CommPortIdentifier) en.nextElement();
System.out.println(portId.getName());
}
}
}
----------------------------------------

Compiled with: javac -classpath rxtx-2.1-7-bins/RXTXcomm.jar
ShowPorts.java

Executed with: java -classpath .:rxtx-2.1-7-bins/RXTXcomm.jar
-Djava.library.path=rxtx-2.1-7-bins/Linux/i686-unknown-linux -gnu ShowPorts

Or executed with: LD_LIBRARY_PATH=rxtx-2.1-7-bins/Linux/i686-unknown-linux-gnu java
-classpath .:rxtx-2.1-7-bins/RXTXcomm.jar ShowPorts

Result:
Experimental: JNI_OnLoad called.
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
/dev/ttyS0

It's the same for swt but with a different shlib.

HTH,
Michael
Re: java.library.path issues with external library [message #223892 is a reply to message #223878] Wed, 08 February 2006 09:50 Go to previous message
Michael is currently offline Michael
Messages: 40
Registered: July 2009
Member
LD_LIBRARY_PATH i mean

> Then it'll be a shared lib and your $PATH... ;)
>
>> Err... I'm running Linux...
Previous Topic:Can I use multiple JDT model to represent the same file loaded at different time
Next Topic:difference between javac and eclipse compile when inheriting abstract Charset
Goto Forum:
  


Current Time: Mon Jul 28 20:36:56 EDT 2014

Powered by FUDForum. Page generated in 0.02792 seconds