Determining the path to a Library

John J. Boyer john.boyer at abilitiessoft.com
Mon Jan 10 17:04:42 UTC 2011


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.

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




More information about the Blinux-list mailing list