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.
To start a REPL session in Eclipse, click the Menu option, go to Run As → Clojure Application. This will start a new REPL session in a separate window along with the console output.
A Clojure REPL (standing for Read-Eval-Print Loop) is a programming environment which enables the programmer to interact with a running Clojure program and modify it, by evaluating one code expression at a time.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With