0

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.

6
  • 1
    What's the question? Have you tried the code you posted? Commented Oct 11, 2011 at 10:18
  • it should work, if I correctly remember... You don't need to eval (use 'user) Commented Oct 11, 2011 at 11:05
  • You're not escaping your double quotes on the command line. Also, what happened to the original "question"? Commented Oct 11, 2011 at 11:17
  • that was general form of same, just question is changed. Commented Oct 11, 2011 at 11:22
  • 1
    Ok, so what is in hello.clj, and what exactly is the error you're getting. Commented Oct 11, 2011 at 11:30

2 Answers 2

1

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\")"
Sign up to request clarification or add additional context in comments.

1 Comment

this is still giving error, java -cp clojure.jar clojure.main -i "hello.clj" -e '(hello "vik")' is working fine. (on windows)
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.