Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't call createTempDirectory in Clojure [duplicate]

Tags:

java

clojure

Code in clojure:

(import '(java.nio.file Files))
(Files/createTempDirectory "Test")

There is error:

CompilerException java.lang.IllegalArgumentException: No matching method: createTempDirectory, compiling:xxxx

But in java's doc http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createTempDirectory(java.lang.String,%20java.nio.file.attribute.FileAttribute...)

There is an String parameter for createTempDirectory, I'm using java 1.7.0

like image 932
Shawn Zhang Avatar asked Dec 15 '25 06:12

Shawn Zhang


1 Answers

Try this code:

(java.nio.file.Files/createTempDirectory "Test"
  (into-array java.nio.file.attribute.FileAttribute []))

As @ymonad mentioned, you cannot omit the variable argument when calling java method with variable arguments. If you don't want to specify the FileAttribute, just pass the empty array of the type.

like image 149
ntalbs Avatar answered Dec 16 '25 19:12

ntalbs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!