public inbox for
 help / color / mirror / Atom feed
* import path vs CLASSPATH
@ 2017-02-08 18:37 Peter Lane
  2017-02-08 21:42 ` Per Bothner
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Lane @ 2017-02-08 18:37 UTC (permalink / raw)
  To: kawa

(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 

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

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 

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

Peter Lane

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-13 19:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-08 18:37 import path vs CLASSPATH Peter Lane
2017-02-08 21:42 ` Per Bothner
2017-02-13 19:31   ` Peter Lane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).