Contrib REPL Invocation Changes

3 views
Skip to first unread message

Randall R Schulz

unread,
Dec 29, 2008, 8:49:23 PM12/29/08
to clo...@googlegroups.com
Hi,

Following today's SVN updates to the Clojure Core and Contrib (as of
this writing, at 17:42 PST, which is GMT -8), I can no longer invoke the
Contrib REPL as I was able to before today. When I do, I get no prompt
until I type a non-empty line, after which I'm presented with an
unending repetition of this:

java.lang.IllegalArgumentException: Wrong number of args passed to: repl-ln$read-hook


My launcher script does this when I request invocation of the Contrib REPL:

% java -cp "..." clojure.main --init /home/rschulz/.clojure/user.clj -e '(use 'clojure.contrib.repl-ln)' -e '(repl)'


So, what is the correct way to invoke the Contrib REPL now?

By the way, the stock REPL works as expected.


Randall Schulz

Stephen C. Gilardi

unread,
Dec 29, 2008, 9:36:54 PM12/29/08
to clo...@googlegroups.com
On Dec 29, 2008, at 8:49 PM, Randall R Schulz wrote:

Following today's SVN updates to the Clojure Core and Contrib (as of
this writing, at 17:42 PST, which is GMT -8), I can no longer invoke the
Contrib REPL as I was able to before today. When I do, I get no prompt
until I type a non-empty line, after which I'm presented with an
unending repetition of this:

Randall R Schulz

unread,
Dec 29, 2008, 11:24:15 PM12/29/08
to clo...@googlegroups.com

Now I'm dumped back to my shell prompt following a single Clojure REPL
prompt (of the Contrib REPL variety) without even touching the
keyboard:

% clojure-svn --crepl +cp=$PROJ_SRC/tau/run +cp=/dar/clojure
1:1 user=>
%


> --Steve


Randall Schulz

Stephen C. Gilardi

unread,
Dec 29, 2008, 11:50:40 PM12/29/08
to clo...@googlegroups.com
Now I'm dumped back to my shell prompt following a single Clojure REPL
prompt (of the Contrib REPL variety) without even touching the
keyboard:

% clojure-svn --crepl +cp=$PROJ_SRC/tau/run +cp=/dar/clojure
1:1 user=>
%

Here it is working with the current clojure.jar and clojure-contrib.jar:

% java -cp clojure.jar:clojure-contrib.jar clojure.contrib.repl_ln
Clojure
1:1 user=> (prn "hi")
"hi"
nil
1:2 user=>    

As for the syntax for clojure.repl_ln loading init files, it's "-i or --init" like clojure.main. "-e" and "--eval" are not currently supported nor is "-r or --repl". Any arg that isn't introduced by "-i" or "--init" marks the beginning of the command-line-args:

 java -cp clojure.jar:clojure-contrib.jar clojure.contrib.repl_ln -i init.clj a b c
Clojure
"loading init.clj"
1:1 user=> *command-line-args*
("a" "b" "c")
1:2 user=> 

(in this case init.clj contained "(prn "loading init.clj")"

--Steve

Randall R Schulz

unread,
Dec 30, 2008, 9:53:40 AM12/30/08
to clo...@googlegroups.com
On Monday 29 December 2008 20:50, Stephen C. Gilardi wrote:
> > ...

>
> Here it is working with the current clojure.jar and
> clojure-contrib.jar:
>
> % java -cp clojure.jar:clojure-contrib.jar clojure.contrib.repl_ln
> Clojure
> 1:1 user=> (prn "hi")
> "hi"
> nil
> 1:2 user=>

I can't replicate that:

% java -cp /repo/JT/clojure-svn/clojure/clojure.jar:/repo/JT/clojure-svn/clojure-contrib/clojure-contrib.jar clojure.contrib.repl_ln
Exception in thread "main" java.lang.NoClassDefFoundError: clojure/contrib/repl_ln
Caused by: java.lang.ClassNotFoundException: clojure.contrib.repl_ln
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:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: clojure.contrib.repl_ln. Program will exit.

Please accept that all the path names are correct, I checked carefully
and more than once and both Clojure Core and Contrib are up-to-date with
the current SVN (as of this writing, of course).


Anyway, I guess it needs to be pointed that the invocation you supplied
won't work unless the Clojure Contrib JAR file is built with pre-
compiled Java classes and that this only happens if you supply the
clojure.jar property ("-Dclojure.jar=path/to/clojure.jar") to your Ant
invocation when you build Clojure Contrib.

Once I figured that out, the problem went away.

Is this documented anywhere?


> ...
>
> --Steve


Randall Schulz

Stephen C. Gilardi

unread,
Dec 30, 2008, 1:19:27 PM12/30/08
to clo...@googlegroups.com

On Dec 30, 2008, at 9:53 AM, Randall R Schulz wrote:

> Anyway, I guess it needs to be pointed that the invocation you
> supplied
> won't work unless the Clojure Contrib JAR file is built with pre-
> compiled Java classes and that this only happens if you supply the
> clojure.jar property ("-Dclojure.jar=path/to/clojure.jar") to your Ant
> invocation when you build Clojure Contrib.
>
> Once I figured that out, the problem went away.
>
> Is this documented anywhere?

I'm not aware of it being documented anywhere.

I've added clojure.contrib.repl-ln/stream-repl to support something
like your original invocation:

% java -cp clojure.jar:clojure-contrib.jar clojure.main -e "(use
'clojure.contrib.repl-ln) (stream-repl)"

This works whether or not clojure-contrib.jar contains compiled code.

--Steve

Reply all
Reply to author
Forward
0 new messages