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

1

6

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.

Unbacked answered 7/10, 2020 at 19:27 Comment(0)
U
17

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.

Unbacked answered 7/10, 2020 at 19:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.