Clojure / lein REPL with jline

For some reason, I can’t get clojure REPL while working with jline, what I did was git to clone the clojure repository with github and then run ant to create it and then load jline-0.9. 94.jar to the directory with clojure.jar, then run the following command:

java -cp jline-0.9.94.jar:clojure.jar jline.ConsoleRunner clojure.main 

And get the following errors:

  Exception in thread "main" java.lang.ClassNotFoundException: clojure.main at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:317) at java.lang.ClassLoader.loadClass(ClassLoader.java:252) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:375) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:164) at jline.ConsoleRunner.main(Unknown Source) 

Here are the files in my current directory:

 vvshs-macbook-2:clojure vvsh$ ls build.xml clojure-sources-1.2.0-master-SNAPSHOT.jar epl-v10.html src classes clojure-sources.jar jline-0.9.94.jar test clojure-1.2.0-master-SNAPSHOT.jar clojure.iml pom-template.xml clojure-slim-1.2.0-master-SNAPSHOT.jar clojure.jar pom.xml clojure-slim.jar doc readme.txt vvshs-macbook-2:clojure vvsh$ 

I got the same error on clojure 1.1 and lein repl (it seems lein supports its own version of clojure).

By the way, this is on mac ox 10.5.8

 java version "1.5.0_24" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_24-b02-357-9M3165) Java HotSpot(TM) Client VM (build 1.5.0_24-149, mixed mode, sharing) 

Does anyone know what happened and how to fix it? Because I really want to get the lane replica to work to start the project.

+6
clojure jline
source share
4 answers

I solved the same problem today by removing the redundant jline*.jar from /Library/Java/Extensions , leaving only one jline installation in CLASSPATH .

Longer explanation: I tried to create a labrepl that installs all its dependencies in the lib subdirectory, but I installed jline earlier by copying the .jar file to /Library/Java/Extensions . Apparently, java.lang.ClassLoader could not handle the two jline installations, and while they were available in two places, running the Clojure REPL command line could not find the last of the jline.ConsoleRunner and clojure.main , depending on in what order they were assigned to the java command.

Hope this helps.

+3
source share

see my alternative installation instructions on my plug:

http://github.com/jedschneider/leiningen

I sent a transfer request to update readme but did not receive a response to it. after installing the lane, you can put bin / leiningen.sh in your ~ / bin and call it anywhere. I put a shortcut in my .bash_profile

alias lein="~/bin/leiningen.sh"

and then call lein repl to start the shell

also check labrepl, which is a great learning tool.

http://github.com/relevance/labrepl

+1
source share

Your java ... team java ... looks great, I would double check if all the banks where you think they should be (and that they are the banks that you think they are, i.e. clojure.jar - this is actually the one you created locally and not some kind of super-obsolete).

If you want to use Leiningen for lein repl , this is also possible. Note that it is inaccurate to say that it "supports its own version of Clojure"; Leiningen is a building tool used as part of a project-oriented workflow, and individual Clojure banks are project dependent. To create a sample project for the game, say lein new foo is conveniently somewhere. Then you need cd foo , get Clojure and contributors with lein deps (the project.clj skeleton provided by lein new already contains entries for both), and run REPL with lein repl .

Finally, you can use the new cljr project; it has a comprehensive README that should launch you as soon as possible, and with it you can tell cljr repl to get the Clojure REPL anywhere, without the need to create a “project”.

0
source share

I met the same problem. jline.ConsoleRunner (at least about jline-0.9.5 that I use) doesn't seem to be able to find class files in the path added to the class search paths from the -cp option of the "java" command. This means that it cannot find any classes in your current directory. I solved this by copying clojure.main to / Library / Java / Extensions /.

0
source share

All Articles