Re: loadLibrary fails in linux
- From: Nigel Wade <nmw@xxxxxxxxxxxx>
- Date: Fri, 28 Nov 2008 11:06:18 +0000
Mike wrote:
Hi
I'm trying to load Java3D library files from an arbitrary location.
In windows i use this code that works fine:
String fileSeparator = System.getProperty("file.separator");
String home = System.getProperty("user.home");
String path = home + fileSeparator + "Application Data" + fileSeparator
+ "Sun" + fileSeparator + "Java" + fileSeparator + "Deployment" +
fileSeparator + "ext";
System.setProperty("java.library.path", path);
System.loadLibrary("j3dcore-d3d");
System.loadLibrary("j3dcore-ogl");
Now i want to do the same in linux using this code but fails:
String fileSeparator = System.getProperty("file.separator");
String home = System.getProperty("user.home");
String path = home + fileSeparator + ".java" + fileSeparator +
"deployment" + fileSeparator + "ext";
System.setProperty("java.library.path", path);
System.loadLibrary("j3dcore-ogl");
It spawns this errror:
java.lang.UnsatisfiedLinkError:no j3dcore-ogl in java.library.path
I've made sure the libj3dcore-ogl.so file is actually there. Printing
out the java.library.path property seemingly reveals the correct path:
/home/mike/.java/deployment/ext
I've tried using
System.load("/home/mike/.java/deployment/ext/libj3dcore-ogl.so") instead
using an absolute path to no avail.
Does anyone know why this doesn't work in linux?
Thanx
Mike
Can you actually change the library search path during execution? Certainly you
can change the system property java.library.path, but does it actually have any
effect? I thought you had to do this via the command line
option -Djava.library.path
You should be able to load the library either by setting the LD_LIBRARY_PATH
environment variable to the directory containing the library in question and
using System.loadLibrary() or directly by using System.load().
How does if fail when you use System.load()?
Things to check.
Are the permissions correct? i.e. can you actually read the file. This applies
to all directories on the path, not just the permissions on file in question.
You need execute permission on each directory and read on the file.
Is the file of the correct type for the architecture? ie. ensure you using a
32bit library on a 32bit system, or a 64bit library on a 64bit system.
--
Nigel Wade
.
- Follow-Ups:
- Re: loadLibrary fails in linux
- From: Nigel Wade
- Re: loadLibrary fails in linux
- References:
- loadLibrary fails in linux
- From: Mike
- loadLibrary fails in linux
- Prev by Date: Re: Quirk with generics
- Next by Date: Best metric available
- Previous by thread: Re: loadLibrary fails in linux
- Next by thread: Re: loadLibrary fails in linux
- Index(es):
Relevant Pages
|