How to invoke Java method in Clojure

Call overloaded Java methods

I get this problem, I want to call the get method of java.nio.file.Paths from clojure, I tried a lot of options, but I always get this error

 
cannot be cast to java.net.URI  user/eval10814 (init.clj:1)
 

This error message indicates that the invocation tries to call this method

 
get(URI uri)
 

What I want to call is this method

 
get(String first, String... more)
 

All the following are not working

 
(java.nio.file.Paths/get "e:\\test.pdf")
(java.nio.file.Paths/get (into-array String ["e:\\test.pdf"]))
(java.nio.file.Paths/get ( String "e:\\test.pdf"))
(java.nio.file.Paths/get ( string "e:\\test.pdf"))
 

The variable length parameter in Clojure is represented as array, in Java if there is no variable length parameter we just omit it, but in Clojure, we need to specify it explicitly to make it match the type signature of Java method, we need to pass it with an empty string array.

Here is the right solution

 
(java.nio.file.Paths/get "e:\\test.pdf" (into-array String []))