开发者

How do I get 'cake repl' working on OSX? (I'm getting 'Exception in thread "main" java.lang.NoClassDefFoundError: clojure/main')

I'm trying to get clojure/emacs/swank/cake all working together. According to assembla I need 'cake repl' to launch a repl, but I keep getting a NoClassDefFoundError. Any idea how to fix that?

Here's what I get in the command line:

$ cake ps
7876 main -Dcake.project=/Users/bmaddy/.cake -Xms16M -Xmx64M -Djava.library.path=lib/dev/native
$ echo $CLASSPATH

$ java -version
java version "1.5.0_26"
Java(TM) 2开发者_开发知识库 Runtime Environment, Standard Edition (build 1.5.0_26-b03-376-9M3263)
Java HotSpot(TM) Client VM (build 1.5.0_26-156, mixed mode, sharing)
$ ruby -v
ruby 1.8.6 (2009-06-08 patchlevel 369) [universal-darwin9.0]
$ cake repl
Exception in thread "main" java.lang.NoClassDefFoundError: clojure/main
     [cake] connection to bake jvm is taking a long time...
     [cake] you can use ^C to abort and use 'cake kill' or 'cake kill -9' to force the jvm to restart
^C/Users/bmaddy/.gem/ruby/1.8/gems/cake-0.5.8/bin/cake:509:in `sleep': Interrupt
    from /Users/bmaddy/.gem/ruby/1.8/gems/cake-0.5.8/bin/cake:509:in `with_socket'
    from /Users/bmaddy/.gem/ruby/1.8/gems/cake-0.5.8/bin/cake:431:in `repl'
    from /Users/bmaddy/.gem/ruby/1.8/gems/cake-0.5.8/bin/cake:430:in `loop'
    from /Users/bmaddy/.gem/ruby/1.8/gems/cake-0.5.8/bin/cake:430:in `repl'
    from /Users/bmaddy/.gem/ruby/1.8/gems/cake-0.5.8/bin/cake:822:in `send'
    from /Users/bmaddy/.gem/ruby/1.8/gems/cake-0.5.8/bin/cake:822
    from /Users/bmaddy/.gem/ruby/1.8/bin/cake:19:in `load'
    from /Users/bmaddy/.gem/ruby/1.8/bin/cake:19

$ cake ps
7876 main -Dcake.project=/Users/bmaddy/.cake -Xms16M -Xmx64M -Djava.library.path=lib/dev/native
12539 main -Dcake.project=/Users/bmaddy/Documents/books/SICP -Xms16M -Xmx64M -Djava.library.path=lib/dev/native

More info:

$ cake deps force
     [deps] Fetching dependencies...
[INFO] snapshot org.clojure:clojure:1.2.0-master-SNAPSHOT: checking for updates from clojure
[INFO] snapshot org.clojure:clojure:1.2.0-master-SNAPSHOT: checking for updates from clojure-snapshots
[INFO] snapshot org.clojure:clojure:1.2.0-master-SNAPSHOT: checking for updates from clojars
[INFO] snapshot org.clojure:clojure:1.2.0-master-SNAPSHOT: checking for updates from maven
Downloading: org/clojure/clojure/1.2.0-master-SNAPSHOT/clojure-1.2.0-master-SNAPSHOT.pom from repository clojure at http://build.clojure.org/releases
Unable to locate resource in repository
[INFO] Unable to find resource 'org.clojure:clojure:pom:1.2.0-master-SNAPSHOT' in repository clojure (http://build.clojure.org/releases)
Downloading: org/clojure/clojure/1.2.0-master-SNAPSHOT/clojure-1.2.0-master-SNAPSHOT.pom from repository clojure-snapshots at http://build.clojure.org/snapshots
Unable to locate resource in repository
[INFO] Unable to find resource 'org.clojure:clojure:pom:1.2.0-master-SNAPSHOT' in repository clojure-snapshots (http://build.clojure.org/snapshots)
Downloading: org/clojure/clojure/1.2.0-master-SNAPSHOT/clojure-1.2.0-master-SNAPSHOT.pom from repository clojars at http://clojars.org/repo
Unable to locate resource in repository
[INFO] Unable to find resource 'org.clojure:clojure:pom:1.2.0-master-SNAPSHOT' in repository clojars (http://clojars.org/repo)
Downloading: org/clojure/clojure/1.2.0-master-SNAPSHOT/clojure-1.2.0-master-SNAPSHOT.pom from repository maven at http://repo1.maven.org/maven2
Unable to locate resource in repository
[INFO] Unable to find resource 'org.clojure:clojure:pom:1.2.0-master-SNAPSHOT' in repository maven (http://repo1.maven.org/maven2)
     [deps] Copying 3 files to /Users/bmaddy/Documents/books/SICP/build/lib
     [deps] Deleting directory /Users/bmaddy/Documents/books/SICP/lib
     [deps] Attempting to rename dir: /Users/bmaddy/Documents/books/SICP/build/lib to /Users/bmaddy/Documents/books/SICP/lib
    [clean] Deleting /Users/bmaddy/Documents/books/SICP/.cake/run/clean
    [clean] Deleting /Users/bmaddy/Documents/books/SICP/.cake/run/default
    [clean] Deleting /Users/bmaddy/Documents/books/SICP/.cake/run/deps
    [clean] Deleting /Users/bmaddy/Documents/books/SICP/.cake/run/help
    [clean] Deleting /Users/bmaddy/Documents/books/SICP/.cake/run/pom
     [deps] Restarting project jvm


Turns out this was a problem with Clojure and Java 1.5. The fix on OS X was to use /Applications/Utilities/Java Preferences.app to switch to Java 1.6.


Looks like your default cake project doesn't have the clojure jar. Try running cake deps force.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜