windowsclojureclojurescript

Error when trying to run ClojureScript on Windows


I try to run ClojureScript "hello-world" project on Windows 10 Home 22H2 19045.4529. I follow documentation from https://clojurescript.org/guides/quick-start and get following output:

C:\Users\1\Documents\hello-world>java -cp "cljs.jar;src" cljs.main --compile hello-world.core --repl
Exception in thread "main" java.lang.StackOverflowError
    at clojure.lang.LazySeq.seq(LazySeq.java:51)at clojure.lang.RT.seq(RT.java:531)
    at clojure.core$seq__5387.invokeStatic(core.clj:137)
    at clojure.core$concat$fn__5478.invoke(core.clj:725)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.RT.seq(RT.java:531)
    at clojure.core$seq__5387.invokeStatic(core.clj:137)
    at clojure.core$concat$fn__5478.invoke(core.clj:725)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.RT.seq(RT.java:531)
    ...

JAVA

C:\\Users\\1\\Documents\\hello-world\>java -version 

java version "1.8.0_411"Java(TM) SE Runtime Environment (build 1.8.0_411-b09) 

Java HotSpot(TM) Client VM (build 25.411-b09, mixed mode, sharing)

FOLDER

C:\Users\1\Documents\hello-world>tree /f /a
C:.
|   cljs.jar
|
\---src
    \---hello_world
            core.cljs

version of cljs.jar latest, 1.11.60

core.cljs

(ns hello-world.core)  

(println "Hello world!")

Clojure

C:\Users\1\Documents\hello-world>clojure
Clojure 1.11.3
user=>

Changing structure of application didn't help. (removing hello_world folder)


Solution

  • I suspect you have the Java JRE installed, whereas Clojure(Script) need the full Java JDK. Not exactly sure how that would lead to a Stack Overflow but try installing a full JDK variant. At least Version 11+, otherwise you'll run into issues a bit later again.

    https://adoptium.net/temurin/releases/?os=windows

    Version 21 is the current LTS (Long Term Support) Release, so I'd recommend that.