Re: loadLibrary fails in linux



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
.



Relevant Pages

  • Re: VB CGI program: oExcel.Workbooks.Open Locks IIS
    ... don't need an EXE to run VB on IIS. ... Setting Everyone as permissions is *irrelevant* in this situation, ... when I open an xls file WITHOUT a macro, ... >> sheet) it's fine, but with the macro, opening fails. ...
    (microsoft.public.inetserver.iis.security)
  • Re: Permission denied
    ... It's generally best to grant permissions only to roles and then control access via role membership since this simplifies administration. ... Some of the users running this app are ... EXECUTE permission denied on object ... ...
    (microsoft.public.sqlserver.security)
  • Re: generating MS-Excel report through ASP.Net without installing
    ... but adding "MACHINENAME\ASPNET" account to the MS Office ... execute permission may help. ... > permissions through DCOMCNFG for MSExcel application. ... > current web request. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: file permissions
    ... users have execute permission, not all users can get at the directory, ... I think it has to do with the ability to do something with a command is ... impossible if it only relied on execute permissions. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: Installer Vise Simply Will Not Run
    ... Well i expect Apple not to offer much help in this case, since, in my mind at least, the onus to fix the problem rests squarely on Mindvision (Installer Vice) or Epson. ... Maybe the execute permission on the Installer isn't set. ... you can follow the subdirectory path down to the actual application and check it's permissions. ... All you can do is copy the file to the hard drive, Option-click or right-click on the file and open the package, and follow the folders to the Contents/MacOS folder. ...
    (comp.sys.mac.system)