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?
I was going through this tutorial today.
I checked here for this error. The version of the standalone jar was correct. The problem was caused by a 'typing mistake' in the core.cljs file. The string "Hello world!" was not in double quotes. Initially the string was in single quotes and included a comma.
The other issue I struggled with was getting the java command to work. I was using a Cygwin64 Terminal.
The correct command for the Cygwin64 Terminal is:
$ java -cp "cljs.jar;src" clojure.main build.clj
In my case, I was typing Windows command by mistake which has "
in the command + make sure you'll have the cljs.jar
in your root folder bes
java -cp cljs.jar:src clojure.main build.clj
I hope it helps someone, one day.:)
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With