无法在Clojure中调用createTempDirectory

Sha*_*ang 2 java clojure

Clojure中的代码:

(import '(java.nio.file Files))
(Files/createTempDirectory "Test")
Run Code Online (Sandbox Code Playgroud)

有错误:

CompilerException java.lang.IllegalArgumentException: No matching method: createTempDirectory, compiling:xxxx
Run Code Online (Sandbox Code Playgroud)

但是在Java的文档中http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createTempDirectory(java.lang.String,%20java.nio.file.attribute.FileAttribute ...)

有一个String参数createTempDirectory,我正在使用Java 1.7.0

nta*_*lbs 6

试试这个代码:

(java.nio.file.Files/createTempDirectory "Test"
  (into-array java.nio.file.attribute.FileAttribute []))
Run Code Online (Sandbox Code Playgroud)

如@ymonad所述,在调用带有可变参数的java方法时不能忽略可变参数。如果您不想指定FileAttribute,则只需传递该类型的空数组即可。