2

The error as shown on the Noir error page: java.io.FileNotFoundException: Could not locate boundaries/lat_long__init.class or boundaries/lat_long.clj on class path

The code that requires it:

(ns boundaries.views.boundary
  (:use noir.core
        hiccup.core
        hiccup.page-helpers)
  (:require
    [boundaries.lat-long :as lat-long]
    [noir.response :as resp]))

Why is it looking for lat_long instead of the specified lat-long? boundaries/lat-long.clj exists as well as the corresponding boundaries.lat-long namespace.

animuson
  • 53,861
  • 28
  • 137
  • 147
Chris
  • 11,819
  • 19
  • 91
  • 145

2 Answers2

4

the JVM does not allow -s in class names so the Clojure compiler converts them to _s

the problem is most likely with the project.clj dependencies.

When diagnosing this sort of issue:

  • is the namespace available from the REPL?
  • does the .class file appear in the lib directory for the project?
  • re-run lein deps
Arthur Ulfeldt
  • 90,827
  • 27
  • 201
  • 284
  • I see. As I'm learning, I'd like to adhere to conventions. Do Clojure developers generally adopt camelcase as in Java? – Chris Jun 26 '12 at 02:08
  • I'm really not the one to ask about java conventions, hopefully someone will comment... It is perfectly fine to use - in the names, I just like not to. i'll remove that from my post, it's too opinionated for SO IMHO ;-) – Arthur Ulfeldt Jun 26 '12 at 02:10
  • Oh no! Fortunately I want to make things that other people use, and as such conventions and personal aesthetics are important – Chris Jun 26 '12 at 02:11
  • @dAni but if the compiler converts them to _ then what do I do? Name the files with _ but the ns with -? – Chris Jun 26 '12 at 02:14
  • Yes. Look at the Clojure source code for plenty of examples. I was also quite surprised/annoyed :), now I just don't realize about it. – DanLebrero Jun 26 '12 at 02:17
0

You need to rename the boundaries/lat-long.clj to boundaries/lat_long.clj.

Note that you don't have to change the namespace name. The clojure convention is to use "-" for functions and namespace names.

From Stuart Sierra response at https://stackoverflow.com/a/4451693/151650: "It's a necessary workaround for Java interoperability."

Community
  • 1
  • 1
DanLebrero
  • 8,545
  • 1
  • 29
  • 30