clojurescript

Clojurescript: Error: Could not find or load main class clojure.main


I installed Clojurescript following its quick start guide.

I pulled the git repo to ~/clojurescript. CLOJURESCRIPT_HOME is set ~/clojurescript and clojurescript/bin is added to system path.

When I try to use commands cljsc I get following error

Could not find or load main class clojure.main

How can I solve it?


Solution

  • Alright coming back after 5 years.

    This error surfaces when one runs clj --main cljs.main --compile hello-world.core --repl from directory or path which does not have file deps.edn or cljs.jar.

    Considering the directory structure at https://clojurescript.org/guides/quick-start,

    hello-world  #### Run that command in this directory
    ├─ src   
    │  └─ hello_world
    │     └─ core.cljs 
    ├─ cljs.jar 
    └─ deps.edn 
    

    i.e.

    $ cd hello-world
    $ clj --main cljs.main --compile hello-world.core --repl