I use lein uberjar to create a standalone jar of an application.
When executing
java -jar dataloader-0.1.0-SNAPSHOT-standalone.jar,
If you want to read the content of the configuration.json
file, do not call io/file
. Instead, use slurp
function, like that:
(def config (slurp (io/resource "configuration.json")))
clojure.java.io/resource
returns a URL, not a file. That's why you can call slurp
on it. The error message is telling you that it's not a file, unfortunately it's not telling you that it's a URL.
Of course you could open the url with the java.net.URL api although that would be overkill in this case.