It's easy to require
a package from clojure:
user=> (require 'clojure.core)
nil
But how can I require a .jar
file inside Clojure?
(I'm trying to learn lein
. Leiningen is useful to big projects rather than small scripts. So I want to figure out that what's the best method to use a jar
package in my Clojure scripts and in REPL.)
Although it's possible to add a jar to an application at runtime with the help of the Pomegranate library, it's highly discouraged as:
I think I'm repeating the other respondents, but thought I'd add the points to validate their advices.
As a matter of fact, lein2 uses pomegranate under the covers, just for the purpose of not having to restart REPL after a dependency is needed. It's only for development purposes.
I don't think you can. The REPL has to be started with the JAR on the classpath.
Have a look at the Pomegranate library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With