Search code examples
clojurenoir

Clojure namespacing converting - to _


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.


Solution

  • 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