Mac OS X Classpath issue in Getting Started?

207 views
Skip to first unread message

Josh Nursing

unread,
Mar 16, 2015, 7:35:40 PM3/16/15
to clojur...@googlegroups.com
I am being frustrated in trying out the latest Clojurescript release on Mac OS X Yosemite. Not sure what I am doing wrong. I follow the Getting Started instructions and get this error on launching "java -cp cljs.jar:src clojure.main build.clj"

"Exception in thread "main" java.io.FileNotFoundException: Could not locate cljs/closure'__init.class or cljs/closure'.clj on classpath:"

David Nolen

unread,
Mar 16, 2015, 7:37:43 PM3/16/15
to clojur...@googlegroups.com
I'm using the JAR right now on OS X Yosemite with Java 8. Are you sure you downloaded the JAR correctly? A few people have mentioned incorrectly grabbing the JAR with curl/wget.

David

On Mon, Mar 16, 2015 at 7:24 PM, Josh Nursing <josh.n...@gmail.com> wrote:
I am being frustrated in trying out the latest Clojurescript release on Mac OS X Yosemite. Not sure what I am doing wrong. I follow the Getting Started instructions and get this error on launching "java -cp cljs.jar:src clojure.main build.clj"

"Exception in thread "main" java.io.FileNotFoundException: Could not locate cljs/closure'__init.class or cljs/closure'.clj on classpath:"

--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to the Google Groups "ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Josh Nursing

unread,
Mar 16, 2015, 9:38:01 PM3/16/15
to clojur...@googlegroups.com
Thanks David,

Tried with a fresh download from the browser, the previous cljs.jar was 19644097 bytes and the new one is 19673805 bytes.

I get the same error with the new one. Is there a configuration lacking with my .profile which prevents Java from reaching closure? I have added the closure/compiler CLOJURESCRIPT_HOME path to CLASSPATH in ~/profile and sourced it but still no go on this one.

I guess I can fall back to using Leiningen or Boot to start new projects as well like before?

Josh

David Nolen

unread,
Mar 16, 2015, 10:12:28 PM3/16/15
to clojur...@googlegroups.com
Many people on OS X have gone through the Quick Start without issue. `java -version` at the command line returns 8 I assume?

If you have some global CLASSPATH thing I would remove that. Not generally a good idea.

Josh Nursing

unread,
Mar 17, 2015, 6:37:38 AM3/17/15
to clojur...@googlegroups.com
Yes, I had made sure yesterday to grab the latest Java. Removed the CLASSPATH, re-checked PATH and access to the bin and script, which are fine, but still no go for me.

lein new figwheel <myprojectname> followed by lein figwheel appears to work for me though.

David Nolen

unread,
Mar 17, 2015, 7:30:56 AM3/17/15
to clojur...@googlegroups.com
And `java -cp cljs.jar clojure.main` drops you into a regular Clojure REPL?

David

Josh Nursing

unread,
Mar 17, 2015, 2:07:06 PM3/17/15
to clojur...@googlegroups.com
Yes, that works and drops me in Clojure 1.6.0 with the user=> prompt.

David Nolen

unread,
Mar 17, 2015, 2:10:51 PM3/17/15
to clojur...@googlegroups.com
I don't know what else to suggest other than you're going to need to try some experiments to figure out what going on, the Clojure REPL you started can help you:

(System/getProperty "java.class.path")
(require 'cljs.closure)

etc.

David

Mike Fikes

unread,
Mar 17, 2015, 2:34:29 PM3/17/15
to clojur...@googlegroups.com
On Monday, March 16, 2015 at 7:35:40 PM UTC-4, Josh Nursing wrote:
> I am being frustrated in trying out the latest Clojurescript release on Mac OS X Yosemite. Not sure what I am doing wrong. I follow the Getting Started instructions and get this error on launching "java -cp cljs.jar:src clojure.main build.clj"
>
> "Exception in thread "main" java.io.FileNotFoundException: Could not locate cljs/closure'__init.class or cljs/closure'.clj on classpath:"

In your build.clj, does it start off with

(require 'cljs.closure')

?

Sergi Mansilla

unread,
Mar 19, 2015, 6:47:53 AM3/19/15
to clojur...@googlegroups.com
I'm having the same issue, same config. Yosemite, java 8 and cljs r3126. Following the precise instructions of https://github.com/clojure/clojurescript/wiki/Quick-Start, but I get the same error. The complete error log looks like this:

$ java -cp cljs.jar:src clojure.main build.clj
Exception in thread "main" java.io.FileNotFoundException: Could not locate cljs/closure'__init.class or cljs/closure'.clj on classpath: , compiling:(/Users/sergi/programming/clj/build.clj:1:1)
at clojure.lang.Compiler.load(Compiler.java:7142)
at clojure.lang.Compiler.loadFile(Compiler.java:7086)
at clojure.main$load_script.invoke(main.clj:274)
at clojure.main$script_opt.invoke(main.clj:336)
at clojure.main$main.doInvoke(main.clj:420)
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 cljs/closure'__init.class or cljs/closure'.clj on classpath:
at clojure.lang.RT.load(RT.java:443)
at clojure.lang.RT.load(RT.java:411)
at clojure.core$load$fn__5066.invoke(core.clj:5641)
at clojure.core$load.doInvoke(core.clj:5640)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5446)
at clojure.core$load_lib$fn__5015.invoke(core.clj:5486)
at clojure.core$load_lib.doInvoke(core.clj:5485)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:626)
at clojure.core$load_libs.doInvoke(core.clj:5524)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:626)
at clojure.core$require.doInvoke(core.clj:5607)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at user$eval1.invoke(build.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6703)
at clojure.lang.Compiler.load(Compiler.java:7130)
... 9 more

David Nolen

unread,
Mar 19, 2015, 6:50:00 AM3/19/15
to clojur...@googlegroups.com
Still missing critical information like the results of running the following after starting a _regular_ Clojure REPL with `java -cp cljs.jar clojure.main`:

(System/getProperty "java.class.path")
(require 'cljs.closure)

Thomas Heller

unread,
Mar 19, 2015, 7:04:23 AM3/19/15
to clojur...@googlegroups.com

> Caused by: java.io.FileNotFoundException: Could not locate cljs/closure'__init.class or cljs/closure'.clj on classpath:

Is it possible you are trying (require 'cljs.closure')? That trailing ' should otherwise not be there. ' means quote in Clojure and is not a String.

David Nolen

unread,
Mar 19, 2015, 7:28:18 AM3/19/15
to clojur...@googlegroups.com
Good catch and shame on me for not reading the precise error closely enough in both cases :)

Yes it look like in both cases you all have written:

(require 'cljs.closure')

which doesn't mean what you think in Clojure, but may seem familiar if you're used to JavaScript. The right thing is:

(require 'cljs.closure)

Updating the QS with this gotcha since it's happened twice already.

David

On Thu, Mar 19, 2015 at 7:04 AM, Thomas Heller <th.h...@gmail.com> wrote:

> Caused by: java.io.FileNotFoundException: Could not locate cljs/closure'__init.class or cljs/closure'.clj on classpath:

Is it possible you are trying (require 'cljs.closure')? That trailing ' should otherwise not be there. ' means quote in Clojure and is not a String.

Sergi Mansilla

unread,
Mar 19, 2015, 9:33:33 AM3/19/15
to clojur...@googlegroups.com
That was it, solved for me now. Silly that I didn't see it before.

Thanks!

Erki Esken

unread,
Mar 20, 2015, 11:33:50 AM3/20/15
to clojur...@googlegroups.com
On Thursday, March 19, 2015 at 1:28:18 PM UTC+2, David Nolen wrote:
> Yes it look like in both cases you all have written:
> (require 'cljs.closure')
> which doesn't mean what you think in Clojure, but may seem familiar if you're used to JavaScript. The right thing is:
> (require 'cljs.closure)
>

I fell into the same trap today following your "Optimizing ClojureScript Function Invocation" article. And had the same trailing ' there after copy-pasting from browser to vim. Seems like some over-eager vim bundle is closing that ' for me automatically.

Just fyi for anyone else ending up here from Google searches :)

--
Erki
Reply all
Reply to author
Forward
0 new messages