|Subject:||Re: Class Not Found Exception when using JLine|
|From:||Toralf Wittner (tora...@gmail.com)|
|Date:||Dec 21, 2007 7:36:00 am|
This is a bug in Jline I would say. Putting the jline JAR in Java's extension directory causes classes from this JAR to be loaded by the extension classloader which is unaware of the class path variable. Now their Console.Runner class tries to instantiate the clojure.lang.Repl class using Class.forName without specifying a different classloader, so the extension classloader is used. The class path is only used by the application class loader which is ignored in the given scenario (they could easily sole this problem by giving the current thread's context classloader to Class.forName).
Quick fix: Don't put the jline jar into Java's ext directory but specify it on the classpath, e.g.
java -cp jline-0.9.93.jar:clojure.jar jline.ConsoleRunner clojure.lang.Repl src/boot.clj
will work assuming jline-0.9.93.jar and clojure.jar ar in the current working directory. If you are on Linux you might consider using rlwrap instead which wraps readline (hence the name).
On Thu, 2007-12-20 at 18:56 -0800, Queueless wrote:
I'm trying to get started with Clojure and was trying to use it with JLine. I'm not a java programmer and so not familiar with all the requirements to install jar files which I assume is my problem. I put the jline jar into the main java extension directory as per the instructions on their site. I can successfully run "java jline.ConsoleRunner" in the clojure install directory and it outputs:
Usage: java [-Djline.history='name'] jline.ConsoleRunner <target class name> [args]
The -Djline.history option will avoid history mangling when running ConsoleRunner on the same application.
args will be passed directly to the target class name.
I can run the clojure REPL successfully, but when I run the following command in the clojure install directory:
java -cp jline-0.9.91.jar:clojure.jar jline.ConsoleRunner clojure.lang.Repl src/boot.clj
Exception in thread "main" java.lang.ClassNotFoundException: clojure.lang.Repl 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:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java: 319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:164) at jline.ConsoleRunner.main(ConsoleRunner.java:69)
So, what am I missing that is causing the ConsoleRunner not to find the clojure.lang.Repl class?
Any help would be appreciated.