How to use Apache Commons Codec library from Clojure?

I am trying to use the Base 64 features found in the Apache Commons Codec package. I use Leiningen and have this in my project.clj :

 :dependencies [[org.clojure/clojure "1.2.0"] [commons-codec/commons-codec "1.4"]] 

Leiningen successfully finds the appropriate .jar. I cannot let my life determine which class I really need to import. I tried all the options

 (ns my-project.core (:import (org.apache.commons.codec.binary Base64))) 

but nothing works. What class name should I use for this?

+7
source share
2 answers

Oops Looks like I just misclassed the class. After the line :import above: (.decode (Base64.) s) worked fine. Thanks for the answers, everyone.

+1
source

I would recommend cutting the chase and checking where the rubber gets on the road. Make sure that Leiningen has indeed placed the correct jar in the lib directory of your project. Open the can and look inside and see what class you are looking for. If the path to this class in the bank should match the path of your import operator.

+1
source

All Articles