Note that there are some explanatory texts on larger screens.

plurals
  1. POCompiling Clojure?
    primarykey
    data
    text
    <p>I'm feeling slightly silly here, but I can't get Clojure Hello World to compile.</p> <p>Directory structure:</p> <pre><code>hello-world/ clojure-1.1.0.jar build/ classes/ src/ test/ hello.clj </code></pre> <p>hello.clj:</p> <pre><code>(ns test.hello (:gen-class)) (defn -main [&amp; args] (println "Hello" (nth args 0))) </code></pre> <p>Interaction:</p> <pre><code>$ cd hello-world [hello-world]$ java -cp ./clojure-1.1.0.jar:./build/classes:./src clojure.main Clojure 1.1.0 user=&gt; (require 'test.hello) nil user=&gt; (test.hello/-main "there") Hello there nil user=&gt; (compile 'test.hello) java.io.IOException: No such file or directory (hello.clj:2) user=&gt; *compile-path* "classes" user=&gt; (doseq [p (.split (System/getProperty "java.class.path") ":")] (println p)) ./clojure-1.1.0.jar ./build/classes ./src nil </code></pre> <p>So I can load and call the file from the REPL, but it doesn't compile.</p> <p>According to <a href="http://clojure.org/compilation" rel="nofollow noreferrer">clojure.org</a>, compilation needs</p> <ul> <li>namespace must match classpath-relative file path - check</li> <li>*compile-path* must be on the classpath - check</li> <li>:gen-class argument to the ns form - check</li> </ul> <p>I found <a href="https://stackoverflow.com/questions/607368/problem-compiling-in-clojure">this post from a year back</a>, as far as I can tell I'm doing exactly the same, but it doesn't work.</p> <p>What am I missing?</p> <p>System: OS X 10.6, Java 1.6.0, Clojure 1.1</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload