letroot
letroot

Reputation: 276

Clojure REPL not launching at Windows command prompt

I have placed the clojure-1.4.0.jar path (C:\clojure-1.4.0\clojure-1.4.0.jar) in my CLASSPATH environment variable. Now when I try to launch the REPL from the command line with the following code:

java -cp clojure-1.4.0.jar clojure.main

I get an error:

Error: Could not find or load main class clojure.main

It used to work before I set up emacs. Any ideas.

Upvotes: 6

Views: 2460

Answers (1)

Vladimir Matveev
Vladimir Matveev

Reputation: 127761

You can either add clojure jar file to CLASSPATH environment variable:

/some/where % CLASSPATH=/tmp/clojure-1.4.0.jar java clojure.main

or specify it directly in java arguments:

/some/where % java -cp /tmp/clojure-1.4.0.jar clojure.main

Setting CLASSPATH variable and providing -cp argument to java command at the same time is pointless, because -cp argument overrides CLASSPATH completely. This is the cause of your problem: you seem to be invoking java command not from the directory where clojure-1.4.0.jar is located, so -cp clojure-1.4.0.jar switch makes java program try to locate clojure-1.4.0.jar in the current directory and ignore CLASSPATH. Since there is no clojure-1.4.0.jar in the current directory, the command fails.

Upvotes: 6

Related Questions