liebke / cljr

cljr is a Clojure REPL and package management system.
236 stars 11 forks source link

Running cljr doesn't add ~/.cljr/lib to the classpath #9

Closed talios closed 14 years ago

talios commented 14 years ago

After installing some libraries I was surprised to find they didn't work, upon investigating I see that ~/.cljr/lib isn't actually being included on the classpath in either ~/.cljr/bin/cljr or ~/.cljr/bin/cljr.bat.

liebke commented 14 years ago

The classpath was never set with the scripts, it was done at runtime with the initialize-classpath function but I think I broke that a bit with the last commit. Fix should be pushed soon.

liebke commented 14 years ago

The initialize-classpath issue should be fixed now.

davidandrzej commented 14 years ago

As of commit X, I needed to un-comment the jar-files binding in the full-classpath function from core.clj:151 to get incanter to load from ~/.cljr/lib

X = 8811052e3ecbadc47df9cd60b4b6aadaa0fc7724

liebke commented 14 years ago

Are you using an older version of the generated cljr script? I had to move some of the class path logic back into the scripts to support using different versions/builds of Clojure.

davidandrzej commented 14 years ago

Should be most recent I think - I did a clone and ran ./script/install. It wouldn't recognize jars in ~/.cljr/lib, but when I uncommented that jar-files binding and re-built it worked fine.

liebke commented 14 years ago

If you copied the cljr script from ~/.cljr/bin into a directory on your path before installing the latest version, you could be using an out of date script that doesn't set the path correctly.

If your cljr script doesn't look like the one below it's probably out of date, run:

which cljr

to see which script you're running, if it's not ~/.cljr/bin/cljr, delete it and add ~/.cljr/bin to your path.

David

!/bin/sh

USER_HOME="/Users/liebke" CLJR_HOME="/Users/liebke/.cljr" CLASSPATH=src:test:. if [ ! -n "$JVM_OPTS" ]; then JVM_OPTS="-Xmx1G" fi if [ "$DISABLE_JLINE" == "true" ]; then JLINE="" else JLINE="jline.ConsoleRunner" fi if [ "$1" == "repl" -o "$1" == "swingrepl" -o "$1" == "swank" -o "$1" == "run" ]; then if [ -n "$CLOJURE_HOME" ]; then for f in "$CLOJUREHOME"/.jar; do CLASSPATH="$CLASSPATH":$f done fi for f in "$CLJRHOME"/lib/.jar; do CLASSPATH="$CLASSPATH":$f done else CLASSPATH="$CLASSPATH":"$CLJR_HOME"/cljr.jar fi if [ "$1" = "repl" ]; then java $JVM_OPTS -Duser.home="$USER_HOME" -Dclojure.home="$CLOJURE_HOME" -Dcljr.home="$CLJR_HOME" -cp "$CLASSPATH" $JLINE clojure.main -e "(require 'cljr.main) (cljr.main/initialize-classpath)" -r else java $JVM_OPTS -Duser.home="$USER_HOME" -Dclojure.home="$CLOJURE_HOME" -Dcljr.home="$CLJR_HOME" -cp "$CLASSPATH" cljr.App $* fi

davidandrzej commented 14 years ago

Oh, it looks like "==" isn't a valid shell operator (at least for my sh on Ubuntu), but it just evaluates the test to false instead of crashing the script. Changing those to "=" everywhere fixes things for me.

liebke commented 14 years ago

Interesting. I've switched the == for = (which works on Mac OS X too). Let me know if the latest version works for you now.

davidandrzej commented 14 years ago

Yes everything works fine now. Looking into it further, the whole thing is due to an oddity of Ubuntu: dash vs bash