I'm trying to build my first clojure leiningen project but I have an issue using a specific java class in my code.
While coding, I was looking for a specific functionnality and found out about DatatypeConverter (http://docs.oracle.com/javase/7/docs/api/javax/xml/bind/DatatypeConverter.html). Then I had to figure how to import the library. I don't know anything about Maven but I ended up somewhat (educated?) guessing I should looking for the library there https://search.maven.org/.
So there is what I ended up writing for my project.clj file:
(defproject game-backend "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:main game-backend.core
:dependencies [
[org.clojure/clojure "1.8.0"]
[javax.xml.bind/jaxb-api "2.2.12"]
])
and here is my ns macro call in my core.clj file:
(ns game-backend.core
(:require [clojure.java.io])
(:import
(java.security DigestInputStream)
(java.io FileInputStream)
(javax.xml.bind DataTypeConverter)
)
)
and when I tun lein run I get the following error (a package was downloaded at some point in time): Exception in thread "main" java.lang.ClassNotFoundException: javax.xml.bind.DataTypeConverter, compiling:(game_backend/core.clj:1:1)
I(m have no idea how many steps I've done wrong (all of them?). Can you please enlight me on how it should be done?
Try a lowercase 't' DatatypeConverter
(ns game-backend.core
(:require [clojure.java.io])
(:import
(java.security DigestInputStream)
(java.io FileInputStream)
(javax.xml.bind DatatypeConverter)
)
)
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