This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

import path vs CLASSPATH


(This is not really a question, but more an observation - perhaps a curious query.)

I found there's a difference between import path and CLASSPATH, with respect to how kawa locates libraries: "import path" seems to be relative to the input program, whereas CLASSPATH is relative to the caller.

The Kawa documentation says "The default search path is |"."| - i.e. just search relative to the current root"; I was expecting the current root to be the directory where I ran kawa, but it appears to be the location of the program.

e.g. if I use -Dkawa.import.path="./*.sld", library files are found only in the same directory as the program I run:

> kawa --r7rs -Dkawa.import.path="./*.sld"  dir/program.sps

only finds libraries within dir, and fails if the required library is in the current (caller's) directory. (If the libraries are in 'dir' the import is unnecessary: kawa --r7rs dir/program.sps will find dir/mylibrary.sld.)

However, if I compile the library: > kawa -C mylibrary.sld, and set CLASSPATH=.

then the .class file for the library will be found relative to the caller's directory.


I came across this because I'm working with a Java library and writing lots of scripts for different tasks. Some common functions are bundled up in a library, for them all to use. The library sits in the directory I run kawa from, and child directories hold the scripts. I've set my run script to use the import path:
-Dkawa.import.path="$(cd "$(dirname "$0")" ; pwd)/*.sld"
which finds the script's path and sets up an absolute path to the import location.

Now I'm aware of this, it's not a problem, but it did confuse me for a bit.

--
Peter Lane
http://peterlane.info/scheme.html


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]