vikbehal
vikbehal

Reputation: 1524

Passing string instead of number to a clojure program throws error

java -cp clojure.jar clojure.main -i "hello.clj" -e "(hello 1)" is working with 1 as a parameter to hello function. java -cp clojure.jar clojure.main -i "hello.clj" -e "(hello "vik")" passing "vik' instead of number is throwing error.

Upvotes: 0

Views: 85

Answers (2)

vikbehal
vikbehal

Reputation: 1524

java -cp clojure.jar clojure.main -i "hello.clj" -e '(hello "vik")' for windows, since double quote is conflicting.

Upvotes: 0

Arthur Ulfeldt
Arthur Ulfeldt

Reputation: 91544

You need to escape the quotation marks around vik. the Shell will interpret these before it starts java. java will see this:

 java -cp clojure.jar clojure.main -i "hello.clj" -e "(hello "   vik   ")"

try

 java -cp clojure.jar clojure.main -i "hello.clj" -e "(hello \"vik\")"

Upvotes: 1

Related Questions