Hi Pradeep,

The exception you are seeing happens when clojure can't find the correct 
method; this is often due to an "arity" mismatch, as is the case here.

.getPath expects two arguments: a String followed by a String array. Java 
makes the variadic parameter seem optional, but in clojure it must 
explicitly be there.

passing nil will get you an npe, but
(.getPath (java.nio.file.FileSystems/getDefault) "/" (make-array String 0))
should work. You could make yourself a convenience function if you're going 
to call it a lot.

Hope that helps you out

Paul

On Monday, May 19, 2014 4:58:53 PM UTC-6, Pradeep Gollakota wrote:
>
> Hi All,
>
> I’m trying to work with NIO in Java 7, and I’m not able to access methods 
> that are declared in the super class.
>
> (.getPath (java.nio.file.FileSystems/getDefault) "/")
>
> The above code throws the following Exception:
>
> Exception in thread "main" java.lang.IllegalArgumentException: No matching 
> method found: getPath for class sun.nio.fs.MacOSXFileSystem, 
> compiling:(/private/var/folders/7t/hd4k0hbn4zx6hvdlhhglncwwnr07sd/T/form-init118501231724308669.clj:1:141)
>     at clojure.lang.Compiler.load(Compiler.java:7142)
>     at clojure.lang.Compiler.loadFile(Compiler.java:7086)
>     at clojure.main$load_script.invoke(main.clj:274)
>     at clojure.main$init_opt.invoke(main.clj:279)
>     at clojure.main$initialize.invoke(main.clj:307)
>     at clojure.main$null_opt.invoke(main.clj:342)
>     at clojure.main$main.doInvoke(main.clj:420)
>     at clojure.lang.RestFn.invoke(RestFn.java:421)
>     at clojure.lang.Var.invoke(Var.java:383)
>     at clojure.lang.AFn.applyToHelper(AFn.java:156)
>     at clojure.lang.Var.applyTo(Var.java:700)
>     at clojure.main.main(main.java:37)
> Caused by: java.lang.IllegalArgumentException: No matching method found: 
> getPath for class sun.nio.fs.MacOSXFileSystem
>     at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:53)
>     at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
>     at filecollector.core$_main.doInvoke(core.clj:33)
>     at clojure.lang.RestFn.invoke(RestFn.java:397)
>     at clojure.lang.Var.invoke(Var.java:375)
>     at user$eval5$fn__7.invoke(form-init118501231724308669.clj:1)
>     at user$eval5.invoke(form-init118501231724308669.clj:1)
>     at clojure.lang.Compiler.eval(Compiler.java:6703)
>     at clojure.lang.Compiler.eval(Compiler.java:6693)
>     at clojure.lang.Compiler.load(Compiler.java:7130)
>     ... 11 more
>
> This seems to be related to the following JIRA 
> CLJ-1243<http://dev.clojure.org/jira/browse/CLJ-1243>
>
> Any thoughts on how to proceed?
>
> Thanks,
> Pradeep
> ​
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to