Determining the path to a Library

Trevor Saunders trev.saunders at gmail.com
Tue Jan 11 02:25:49 UTC 2011


On Mon, Jan 10, 2011 at 11:04:42AM -0600, John J. Boyer wrote:
> I am usinng the library as part of a cross-platform Java application 
> (BrailleBlaster). I know where the library is in relation to the .jar 
> file, but I can't depend on it's being loaded in any absolute path. It 
> will not be loaded with autotools, but will simply accompany the .jar 
> file. It referencees its data in a path relative to itself. So the 
> problem is either to tell it the absolute path or have it discover it.

Well, you are definitely doing something very non-standard here.  The
whole autotools build system is fairly based around the idea you
configure for a particular install location.  Which I suspect will make
the people who package BrailleBlaster for  linux distributions will
probably be rather unhappy with this arrangement, but whatever.  I think
you'll have to somehow tell the library where to look I think.  Or you
could arrange for the app to change its current directory to the dir
holding the jar file or add that directory to the class path.

btw is the source publicly avialable somewhere?

Trev

> 
> John
> 
> On Mon, Jan 10, 2011 at 09:38:38AM -0500, Trevor Saunders wrote:
> > On Mon, Jan 10, 2011 at 06:42:25AM -0600, John J. Boyer wrote:
> > > Is there a reliable way for a library to determine the path from which 
> > > it wa loaded. I want to use this as a base for referencing the data 
> > > files that the library uses. Will this work on Mac OSX also?
> > 
> > the only thing that comes to mind is looking around in /proc/self for
> > something useful.  I believe the standard solution to this problem is
> > that you  use a #define for the path of the data in the source, and then
> > use the build system to arrange for that define to be defined as
> > whatever the path should actually be.  So what whould generally happen
> > is that autotools stuff would arrange for DATA_PATH to be defined as
> > what ever the make variable DATADIR is.  This should be fairly portable,
> > but I don't have an OSX box so....
> > 
> > Trev
> > 
> > > 
> > > Thanks,
> > > John
> > > 
> > > -- 
> > > John J. Boyer; President, Chief Software Developer
> > > Abilitiessoft, Inc.
> > > http://www.abilitiessoft.com
> > > Madison, Wisconsin USA
> > > Developing software for people with disabilities
> > > 
> > > _______________________________________________
> > > Blinux-list mailing list
> > > Blinux-list at redhat.com
> > > https://www.redhat.com/mailman/listinfo/blinux-list
> 
> 
> 
> > _______________________________________________
> > Blinux-list mailing list
> > Blinux-list at redhat.com
> > https://www.redhat.com/mailman/listinfo/blinux-list
> 
> -- 
> John J. Boyer; President, Chief Software Developer
> Abilitiessoft, Inc.
> http://www.abilitiessoft.com
> Madison, Wisconsin USA
> Developing software for people with disabilities
> 
> _______________________________________________
> Blinux-list mailing list
> Blinux-list at redhat.com
> https://www.redhat.com/mailman/listinfo/blinux-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/blinux-list/attachments/20110110/096e9c3f/attachment.sig>


More information about the Blinux-list mailing list