Renato Byrro
Renato Byrro

Reputation: 3784

Could not locate clojure/test/check__init.class, clojure/test/check.clj or clojure/test/check.cljc on classpath

I'm new to Clojure and Lisp as a whole. Following Chapter 14 of the Getting Clojure book, it suggests loading clojure.test.check.generators in a way that appeared to me as if it's a native library embedded in clojure.test.

Turns out it's not. Trying to (require '[clojure.test.check.generators]) gives an error:

Could not locate clojure/test/check__init.class, clojure/test/check.clj or clojure/test/check.cljc on classpath.

Upvotes: 6

Views: 1638

Answers (1)

Renato Byrro
Renato Byrro

Reputation: 3784

The book doesn't instruct clearly that I needed to properly declare check as a project dependency before trying to require it.

What I needed to do is to open project.clj file and, under :dependencies add this: [org.clojure/test.check "1.1.0"]. Check the latest version on the library's repo.

I'm documenting here since searching for the error string returned nothing straightforward for me to fix the issue. Although this seems pretty basic, this response should save a few minutes of digging around from other people that are also just starting out.

Upvotes: 19

Related Questions