From: Alan W. I. <ir...@be...> - 2001-11-13 15:26:44
|
On Mon, 12 Nov 2001, Geoffrey Furnish wrote: > Alan W. Irwin writes: > > I agree there is nothing we can do with libplplot. What I am asking is > > whether there is a mechanism *under java* (some additional command in > > PLStream.java or some javac option) which allows java to find libplplot (or > > any other C extension library) when it is installed in a non-standard place. > > I would be surprised and disappointed if java relied solely on > > LD_LIBRARY_PATH to solve this problem. > > Well, it's not anything special to java. We're just talking about the > semantics of dlopen(), which all programs use to load .so's. From what you have found out about dlopen, it looks like you can do anything with it. Thus, looking at this from the java level, java is free to do anything before the low-level call to dlopen. So it really becomes a question of how java integrates the specification of library names using System.loadLibrary with their treatment (if any) of the library path. I did try your suggestion of using an absolute path as part of the library name. (That is quite easy to do in a configurable way by making the appropriate modification to config.java which in turn is accessed by the System.loadLibrary call in PLStream.java.) Alas, this idea did not work. The run time error was as follows: Exception in thread "main" java.lang.UnsatisfiedLinkError: Directory separator should not appear in library name: /home/software/plplot_cvs/HEAD/plplot/tmp/plplotd So apparently there is some name interpretation going on before the dlopen call, and as part of that interpretation java insists the path must not be part of the name specified to System.loadLibrary. Of course, this still leaves wide open the question about whether there might be some alternative mechanism in java to specify the path part of the name since java can do anything it likes before the dlopen call. Thus, what I am looking for is the java analog of the python sys.path.insert() function that we use in pythondemos.py to manipulate the path where python looks for plmodules.so. Unfortunately, I am now stuck because I don't know how to search for such functionality in the enormous number of java functions that are available. Geoffrey, are you aware of a general site where I could specify say "library path" as a search string and it would find all the java functions that have something to do with the library path? The java tutorial does have a search engine so I tried that, but all it came up with was the LD_LIBRARY_PATH idea. I suppose it is possible that java has no way to specify the library path other than LD_LIBRARY_PATH, but that is quite limited compared to the sys.path.insert() function available for python. Alan |