Clojurescript: Error: Could not find or load main class clojure.main
Clojurescript: Error: Could not find or load main class clojure.main
之后安装了 Clojurescript
我将 git 回购拉到了 ~/clojurescript
。
CLOJURESCRIPT_HOME
设置为 ~/clojurescript
并且 clojurescript/bin
添加到系统路径。
当我尝试使用命令时 cljsc
我收到以下错误
Could not find or load main class clojure.main
我该如何解决?
我今天正在学习这个教程。
我在这里检查了这个错误。独立 jar 的版本是正确的。问题是由 core.cljs 文件中的 'typing mistake' 引起的。字符串 "Hello world!" 不在 双引号 中。最初该字符串在单引号中并包含一个逗号。
我遇到的另一个问题是让 java 命令起作用。我使用的是 Cygwin64 终端。
Cygwin64 终端的正确命令是:
$ java -cp "cljs.jar;src" clojure.main build.clj
在我的例子中,我错误地输入了 Windows 命令,命令中有 "
+ 确保你的根文件夹 bes[= 中有 cljs.jar
13=]
java -cp cljs.jar:src clojure.main build.clj
我希望有一天它能帮助到某人。:)
好吧时隔5年回来
从没有文件 deps.edn
或 cljs.jar
.
的目录或路径运行 clj --main cljs.main --compile hello-world.core --repl
时会出现此错误
考虑 https://clojurescript.org/guides/quick-start、
处的目录结构
hello-world #### Run that command in this directory
├─ src
│ └─ hello_world
│ └─ core.cljs
├─ cljs.jar
└─ deps.edn
即
$ cd hello-world
$ clj --main cljs.main --compile hello-world.core --repl
如果您使用 leiningen 创建了项目,那么您的项目 cli 将如下所示
(defproject clojuredemo "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]]
)
在 :dependencies 之后添加以下行
:jar-name "<project-name>.jar"
:jar-path "/target/<project-name>.jar"
注意:您需要将项目名称替换为您的项目
之后运行下面的命令
lein jar
确保类路径中的 JAR 文件存在:
java -cp target/missing-file.jar clojure.main your.namespace
会混淆地抛出 Could not find or load main class clojure.main
.
我将 git 回购拉到了 ~/clojurescript
。
CLOJURESCRIPT_HOME
设置为 ~/clojurescript
并且 clojurescript/bin
添加到系统路径。
当我尝试使用命令时 cljsc
我收到以下错误
Could not find or load main class clojure.main
我该如何解决?
我今天正在学习这个教程。
我在这里检查了这个错误。独立 jar 的版本是正确的。问题是由 core.cljs 文件中的 'typing mistake' 引起的。字符串 "Hello world!" 不在 双引号 中。最初该字符串在单引号中并包含一个逗号。
我遇到的另一个问题是让 java 命令起作用。我使用的是 Cygwin64 终端。
Cygwin64 终端的正确命令是:
$ java -cp "cljs.jar;src" clojure.main build.clj
在我的例子中,我错误地输入了 Windows 命令,命令中有 "
+ 确保你的根文件夹 bes[= 中有 cljs.jar
13=]
java -cp cljs.jar:src clojure.main build.clj
我希望有一天它能帮助到某人。:)
好吧时隔5年回来
从没有文件 deps.edn
或 cljs.jar
.
clj --main cljs.main --compile hello-world.core --repl
时会出现此错误
考虑 https://clojurescript.org/guides/quick-start、
处的目录结构hello-world #### Run that command in this directory
├─ src
│ └─ hello_world
│ └─ core.cljs
├─ cljs.jar
└─ deps.edn
即
$ cd hello-world
$ clj --main cljs.main --compile hello-world.core --repl
如果您使用 leiningen 创建了项目,那么您的项目 cli 将如下所示
(defproject clojuredemo "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]]
)
在 :dependencies 之后添加以下行
:jar-name "<project-name>.jar"
:jar-path "/target/<project-name>.jar"
注意:您需要将项目名称替换为您的项目
之后运行下面的命令
lein jar
确保类路径中的 JAR 文件存在:
java -cp target/missing-file.jar clojure.main your.namespace
会混淆地抛出 Could not find or load main class clojure.main
.