I am trying to compile the clojure source file into a class file and only run it using the command line, without lein or (possibly) an answer.
I have core.clj in a directory src/hello.
.
└── src
└── hello
└── core.clj
This is the source code.
(ns hello.core)
(defn -main
"This should be pretty simple."
[]
(println "Hello, World!"))
using (compile)in REPL.
From the hint on this site ( http://clojure.org/compilation ) I tried to get the class file from REPL.
I started REPL with lein replin the src directory and then tried to compile to get an error message.
user=> (compile 'hello.core)
CompilerException java.io.IOException: No such file or directory, compiling:(hello/core.clj:1:1)
Command line
clojure.clj .class/.jar clojure, , clojure REPL.
., .
> java -cp .:<PATH>/clojure-1.6.0.jar -Dclojure.compile.path=build clojure.lang.Compile src/hello/core.clj
Compiling src/hello/core.clj to build
Exception in thread "main" java.io.FileNotFoundException: Could not locate
hello/core/clj__init.class or hello/core/clj.clj on classpath:
at clojure.lang.RT.load(RT.java:443)
at clojure.lang.RT.load(RT.java:411)
...
, :
- clojure / REPL?
- Java?
java -cp .:CLOJURE_JAR main?