3
votes

I've been trying to set up Clojure to use Overtone.

However, I get this message when I try to fire up Lein inside of the Project folder:

Exception in thread "main" java.lang.Exception: EOF while reading string (project.clj:5)
    at clojure.lang.Compiler.load(Compiler.java:5864)
    at clojure.lang.Compiler.loadFile(Compiler.java:5821)
    at clojure.lang.RT$3.invoke(RT.java:296)
    at leiningen.core$read_project$fn__2128.invoke(core.clj:127)
    at leiningen.core$read_project.invoke(core.clj:126)
    at leiningen.core$read_project.invoke(core.clj:130)
    at leiningen.core$_main.doInvoke(core.clj:320)
    at clojure.lang.RestFn.invoke(RestFn.java:410)
    at clojure.lang.AFn.applyToHelper(AFn.java:161)
    at clojure.lang.RestFn.applyTo(RestFn.java:132)
    at clojure.core$apply.invoke(core.clj:542)
    at leiningen.core$_main.invoke(core.clj:332)
    at user$eval42.invoke(NO_SOURCE_FILE:1)
    at clojure.lang.Compiler.eval(Compiler.java:5425)
    at clojure.lang.Compiler.eval(Compiler.java:5392)
    at clojure.core$eval.invoke(core.clj:2382)
    at clojure.main$eval_opt.invoke(main.clj:235)
    at clojure.main$initialize.invoke(main.clj:254)
    at clojure.main$script_opt.invoke(main.clj:270)
    at clojure.main$main.doInvoke(main.clj:354)
    at clojure.lang.RestFn.invoke(RestFn.java:436)
    at clojure.lang.Var.invoke(Var.java:373)
    at clojure.lang.AFn.applyToHelper(AFn.java:167)
    at clojure.lang.Var.applyTo(Var.java:482)
    at clojure.main.main(main.java:37)
Caused by: java.lang.Exception: EOF while reading string
    at clojure.lang.LispReader$StringReader.invoke(LispReader.java:407)
    at clojure.lang.LispReader.readDelimitedList(LispReader.java:1051)
    at clojure.lang.LispReader$VectorReader.invoke(LispReader.java:998)
    at clojure.lang.LispReader.readDelimitedList(LispReader.java:1051)
    at clojure.lang.LispReader$VectorReader.invoke(LispReader.java:998)
    at clojure.lang.LispReader.readDelimitedList(LispReader.java:1051)
    at clojure.lang.LispReader$ListReader.invoke(LispReader.java:900)
    at clojure.lang.LispReader.read(LispReader.java:145)
    at clojure.lang.Compiler.load(Compiler.java:5854)
    ... 24 more

I have ascertained that it's not due to mismatched parens. I did a search around the Internet and found this. It seems that people solved their problems by switching to JDK from JRE. Note that they are talking about Windows.

I am using Ubuntu Linux and have never developed in Java. I have only a cursory understanding of the different Java technologies. Could someone help me figure out this please! That would be very kind of you. It's a very unpleasant snag am I was just trying to get started in the "oh so wonderful" Clojure. (It is wonderful, no sarcasm intended.)

Question 2: I am very new to Clojure. I used Scheme while doing the SICP in college and decided to move to a more modern LISP dialect. I am comfortable with the syntax however I want to know if Clojure is tied heavily to the "Java ecosystem"? I know it is tied to Java in the general sense of the word; but do you Clojure programmers feel like you are working in Java with just parens added or is Clojure really an ecosystem running on JVM? I had high hopes but after running into such a Java related snag I am pretty disappointed.

Here's the project.clj (Thanks for mentioning @Arthur Ulfeldt):

    (defproject tutorial "1.0"
        :dependencies [ [org.clojure/clojure "1.5.1"]
                        [overtone "0.8.1"] ])

It's from the "Getting Started" section at Overtone.

2
You would be better to ask one question at the time. Clojure is not only tied to Java in terms of api's, but it is written partly in Java, so if you're doing relatively low level stuff you could need to understand Java. Moreover, it is obviously helps to understand java runtime stuff (like bytecode, garbage collection, JIT, reflection and so on).om-nom-nom
could you include the contents of project.clj? it will really help debugging this.Arthur Ulfeldt
there aren't five lines in that project.clj, perhaps the file was not saved?Arthur Ulfeldt
I copy pasted again to make sure... Does not work, I'll upgrade my SDK, Lein and see if it works. Apparently that worked for some people.Roald
If that is really your project.clj, I expect hidden nonprinting unicode. The error is not a java error, it is just an error that exposes some java implementation details. The clojure parser got to line five of your three line file and a string that had been opened was not yet closed.noisesmith

2 Answers

4
votes

Question 2:

Clojure is a hosted language and one of the core philosophies is embrace the platform. It is idiomatic to use existing Java libraries where they are simple enough and wrap or replace them when they complicate things. I have found Clojure to be an excellent way to learn the Java ecosystem. The other driving principles are to keep things separated and simple, as well as to track identity and time appropriately.

3
votes

The stacktrace makes it look to me like your project.clj reads like:

(defproject whatever "1.0"
  :dependencies [[something "1.0]])

Basically, you are missing a close-quote for a string, and that string is nested inside of two vectors. Most likely that means :dependencies, but it could be elsewhere. The problem is probably on line 5 of project.clj, so start looking there.