public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Peter Lane <peter@peterlane.info>
To: kawa@sourceware.org
Subject: import path vs CLASSPATH
Date: Wed, 08 Feb 2017 18:37:00 -0000	[thread overview]
Message-ID: <4f61b6b2-78f7-a327-6eb3-7778eab00233@peterlane.info> (raw)

(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

             reply	other threads:[~2017-02-08 18:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08 18:37 Peter Lane [this message]
2017-02-08 21:42 ` Per Bothner
2017-02-13 19:31   ` Peter Lane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4f61b6b2-78f7-a327-6eb3-7778eab00233@peterlane.info \
    --to=peter@peterlane.info \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).