atom feed4 messages in com.googlegroups.clojureRe: Class Not Found Exception when us...
FromSent OnAttachments
QueuelessDec 20, 2007 6:56 pm 
Rich HickeyDec 21, 2007 4:22 am 
Toralf WittnerDec 21, 2007 7:36 am 
QueuelessDec 21, 2007 5:45 pm 
Subject:Re: Class Not Found Exception when using JLine
From:Toralf Wittner (
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).

Cheers, Toralf

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

I get:

Exception in thread "main" java.lang.ClassNotFoundException: clojure.lang.Repl at$ at Method) at at java.lang.ClassLoader.loadClass( at java.lang.ClassLoader.loadClass( at java.lang.ClassLoader.loadClassInternal( 319) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName( at jline.ConsoleRunner.main(

So, what am I missing that is causing the ConsoleRunner not to find the clojure.lang.Repl class?

Any help would be appreciated.