Fork me on GitHub

How do I require a library that I have written that is not in the same dir, like a utils library? Can I specify dependencies somehow?


This should get you started, though there might (and, if not, should) be a document or section in the Joker distribution that gives a useful overview:

user=> (doc ns-sources)
  Adds to the built-in variable *ns-sources* which defines how to resolve
  external dependencies.
user=> (doc joker.core/*ns-sources*)
  A map from namespace reg-exps to the source to load the external dependency from
user=> (doc joker.core/*classpath*)

  A vector of the classpath elements as configured by --classpath or
  the JOKER_CLASSPATH environment variable.

  Use colon-delimited <cp> (semicolon-delimited on Windows) for source
  directories when loading libraries via :require and the like (but
  not load-file). An empty field denotes the directory containing the
  current file being loaded, with zero or more trailing components
  removed as determined by the number of "." separators in the current
  namespace; or, if no file is being loaded, the current
  directory (this is original Joker behavior); a '.' (period) by
  itself denotes solely the current directory. Defaults to the value
  of the JOKER_CLASSPATH environment variable or, if that is
  undefined, the empty string (denoting a single empty field). The
  resulting classpath is stored herein, and this variable is used (in
  lieu of command-line arguments or environment variables) for all
  pertinent subsequent operations.



👍 4

After seeing various questions here about libraries, decided to take on documenting some about this, borrowing heavily from here and elsewhere: Feel free to comment on the PR. Hope it's useful!

thanks 4

This was merged a short while ago, so is now on master.