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?
55 Answers
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 ,
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 have created your project using leiningen then your project cli would look something like this
(defproject clojuredemo "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "" :license {:name "Eclipse Public License" :url ""} :dependencies [[ "1.6.0"]] ) After the :dependencies add the following lines
:jar-name "<project-name>.jar" :jar-path "/target/<project-name>.jar" Note : you need the replace the project name with your project
After that run the following command
lein jar Ensure that the JAR file at classpath exists:
java -cp target/missing-file.jar clojure.main your.namespace will confusingly throw Could not find or load main class clojure.main.