Sorry, I'm a bit in a hurry ;-) You give a vector, it needs an array. Try something like:
spels=> (make-array (.getClass "") 2 ) #<String[] [Ljava.lang.String;@ad8659> spels=> (def arr (make-array (.getClass "") 2 )) #'spels/arr spels=> (aset arr 0 "write") "write" spels=> (aset arr 1 "c:\\config.sys") "c:\\config.sys" spels=> (.exec (Runtime/getRuntime) arr) Greezs, alux Tim Daly schrieb: > The call I coded works if you only pass a string with no spaces. > > However, if the string has spaces there is no result. > If you break the string into String[] then clojure cannot match the > appropriate exec(String[]) method in Runtime. I do not know how > to convince clojure to call this method. > > alux wrote: > > The call to a static method is special, try > > > > (.exec (Runtime/getRuntime) "ls") > > > > Regards, alux > > > > TimDaly schrieb: > > > >> (defn cmdresult [cmdstr] > >> (let [args (into [] (seq (.split cmdstr " ")))] > >> (BufferedReader. > >> (InputStreamReader. > >> (. (. (. Runtime (getRuntime)) (exec args)) > >> (getInputStream)))))) > >> > >> (defn readLine [cmdresult] (. cmdresult (readLine))) > >> > >> (def a (cmdresult "ls *.o")) > >> > >> This fails claiming: > >> No matching method found: exec for class java.lang.Runtime > >> > >> If I replace the Runtime line with: > >> (. (. (. Runtime (getRuntime)) (exec "ls")) (getInputStream)))))) > >> it works and gives me the result of the "ls" system call. > >> > >> If I replace the Runtime line with > >> (. (. (. Runtime (getRuntime)) (exec "ls *.o")) > >> (getInputStream)))))) > >> it fails even though it has a string argument. > >> > >> Suggestions? > >> > >> Tim Daly > >> > > > > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.