Super beginner question here. I'm following the (good) book Programming Clojure, and chapter 5 is about coding a small Snake game. Utility code is provided, and I decided to follow it by starting a new Leiningen project (lein new app snake
). In my src/snake/core.clj
I'd like to :use
a file named import_static.clj
written by the authors. I copied the file into src/snake
, and in src/snake/core.clj
I copied from the samples the import line (:use snake.import-static)
. But when I evalute the whole file in the REPL I have this error : "FileNotFoundException Could not locate import_static__init.class or import_static.clj on classpath".
Using Clojure 1.5.1, both in the project.clj
file and the editor's REPL (SublimeText + plugin SublimeREPL). The directory structure :
src/
snake/
core.clj
import_static.clj
Top of core.clj
:
(ns snake.core
(:import (java.awt Color Dimension)
(javax.swing JPanel JFrame Timer JOptionPane)
(java.awt.event ActionListener KeyListener))
(:gen-class)
(:use snake.import-static))
Top of import_static.clj
:
(ns ^{:author "Stuart Sierra",
:doc "Import static Java methods/fields into Clojure"}
snake.import-static
(:use clojure.set))
I tried removing the snake
from both the :use
call and the namespace declaration, with no luck. Can you help me ? Note that I have no knowledge of the JVM, and it may be the classpath or my editor.