1

I'm trying to follow the Clojurescript Quick-Start

I have downloaded the Clojurescript jar as described in the Quick-Start guide. I have verified that it has the appropriate size (about 19M). I have created the files. But when I try to build using the command:

java -cp cljs.jar:src clojure.main build.clj

Java returns the following stacktrace:

Exception in thread "main" java.io.FileNotFoundException: Could not locate cls/build/api__init.class or cls/build/api.clj on classpath., compiling:(/Users/jnedzel/Documents/prj/closurescript/quickstart/hello_world/build.clj:1:1)
    at clojure.lang.Compiler.load(Compiler.java:7249)
    at clojure.lang.Compiler.loadFile(Compiler.java:7175)
    at clojure.main$load_script.invoke(main.clj:275)
    at clojure.main$script_opt.invoke(main.clj:337)
    at clojure.main$main.doInvoke(main.clj:421)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.lang.Var.invoke(Var.java:379)
    at clojure.lang.AFn.applyToHelper(AFn.java:154)
    at clojure.lang.Var.applyTo(Var.java:700)
    at clojure.main.main(main.java:37)
Caused by: java.io.FileNotFoundException: Could not locate cls/build/api__init.class or cls/build/api.clj on classpath.

Any ideas?

nberger
  • 3,659
  • 17
  • 19
Jared Nedzel
  • 779
  • 1
  • 6
  • 10

1 Answers1

1

TL;DR: There's a typo in build.clj

Full explanation

As of the Quick-Start, the file build.clj should have the following content:

(require 'cljs.build.api)

(cljs.build.api/build "src" {:output-to "out/main.js"})

The error message says Could not locate cls/build/api__init.class. When the clojure compiler compiles a ns, a loader classfile is generated with the name my/domain/lib__init.class. That's the class that will be loaded given (require 'my.domain.lib).

In the case of cljs.build.api, that would be cljs/build/api__init.class. But it is trying to load cls/build/api__init.class instead, so you have a typo there.

nberger
  • 3,659
  • 17
  • 19