I have a Clojure project I created with lein new
. My Clojure files are all within a src
folder, and all seem to be compiled when I run lein uberjar
(I see errors in them when things are missing).
Within src
, I have a folder myns
with junk.clj
in it. That file has
(ns myns.junk)
(defn sq [x] (* x x))
After loading the jar created by lein uberjar in my java project, I can import and call that function via
import myns.junk$sq;
public class JavaApplication1 {
public static void main(String[] args) {
System.out.println(junk$sq.invokeStatic(5));
}
}
But I can't, for the life of me, figure out how to import functions from files that are not in a folder. Top-level files in my src folder seem invisible and unable to be imported on the Java side.
How do I tell Clojure to put similar functions in top-level files into some namespace that Java can import?