I am trying to use a static inner class from a Java library into Clojure.
The inner class is InMemoryLookupCache.Builder.
I am always getting a ClassNotFoundException. Like with:
(import 'org.deeplearning4j.models.word2vec.wordstore.inmemory.InMemoryLookupCache$Builder)
I am trying to write that Java code in Clojure without any success:
new InMemoryLookupCache.Builder().lr(2e-5).vectorLength(100).build();
However I am not able to instantiate that inner class even if I think I am right using the $ syntax to access it.
If you want to try, use the following projects:
[org.deeplearning4j/deeplearning4j-core "0.0.3.3"]
[org.deeplearning4j/deeplearning4j-nlp "0.0.3.3"]
If this is the class you are using, I don't see a Builder inner class?
EDIT: This is working for me. Changed the version of the library to the same one the example is using.
in project.clj:
(defproject clojure-scratch "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"}
:dependencies [[org.clojure/clojure "1.6.0"]
[org.deeplearning4j/deeplearning4j-core "0.0.3.2.7"]
[org.deeplearning4j/deeplearning4j-nlp "0.0.3.2.7"]])
in core.clj:
(ns clojure-scratch.core
(:import (org.deeplearning4j.models.word2vec.wordstore.inmemory
InMemoryLookupCache
InMemoryLookupCache$Builder)))
(println (new InMemoryLookupCache$Builder))
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