Reputation: 3046
I have two files test.clj and test2.clj in the same directory.
I want to import the functions from test2.clj
test.clj looks like this:
(ns test
(:require [test2 :refer :all])
)
test2.clj like this:
(defn showworld []
(println "hello world")
)
But when i execute test.clj in cider, i get: Could not locate test2__init.class, test2.clj or test2.cljc on classpath.
Upvotes: 0
Views: 398
Reputation: 45
Though you are providing a file name as test2.clj
, that's not sufficient, you should also have namespace declaration which we do with ns
, and then code inside test2.clj
goes as following :
(ns test2)
(defn showworld []
(println "hello world")
)
Upvotes: 0
Reputation: 652
You are missing the namespace declaration in test2.clj. When we :require
something, we are requiring the namespace (not the file).
Try changing test2.clj to the following:
(ns test2)
(defn showworld []
(println "hello world"))
Upvotes: 2