Reputation: 13626
I'm working through "Clojure in Action", and I have been instructed to create a file "in a folder named chapter08 within your source directory" and try to require it.
I created the following files (tried both - and _ delimited)
~/clojure-1.4.0$ ls src/chapter08/
date-operations-spec.clj date_operations.clj
date-operations.clj date_operations_spec.clj
I tried to require in the REPL using code from the book, but keep failing:
~/clojure-1.4.0$ java -cp clojure-1.4.0.jar clojure.main
Clojure 1.4.0
user=>
(ns chapter08.date-operations-spec
(:use chapter08.date-operations)
(:use clojure.test))
FileNotFoundException Could not locate chapter08/date_operations__init.class or chapter08/date_operations.clj on classpath: clojure.lang.RT.load (RT.java:432)
Upvotes: 2
Views: 292
Reputation: 91554
use leiningen which has become the ubiquitous tool for managing such things since Amit published that excellent book. I just spent longer writing this than the time required to setup leiningen.
then run lein new chapter8.
copy the file to chapter8/src/chapter8/
Run lein repl
Upvotes: 5
Reputation: 17773
Using plain java to start clojure is a pain in the neck. For instance, your java -cp ...
call will not put ./src on the classpath . Please just use leiningen.
Upvotes: 1