Search code examples
clojureapache-commons

How do I use the Apache Commons Codec library from Clojure?


I'm trying to use the Base 64 functions present in the Apache Commons Codec package. I'm using 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 can't for the life of me figure out which class I actually need to import, though. I have tried all variations of

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

but nothing seems to work. What class name should I be using for this?


Solution

  • Whoops. It looks like I was just calling the class itself incorrectly. The following worked fine after the :import line above: (.decode (Base64.) s). Thanks for the responses, everyone.