When I call Files.createTempDirectory("") I get the below exception:
java.lang.NullPointerException
at sun.nio.fs.WindowsSecurityDescriptor.fromAttribute(WindowsSecurityDescriptor.java:353)
at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:220)
at java.nio.file.Files.newByteChannel(Files.java:315)
at java.nio.file.Files.createFile(Files.java:586)
at java.nio.file.TempFileHelper.create(TempFileHelper.java:138)
at java.nio.file.TempFileHelper.createTempFile(TempFileHelper.java:161)
at java.nio.file.Files.createTempFile(Files.java:803)
None of the examples of the usage of Files.createTempDirectory("") I have found passed in any FileAttributes.
I have tried with Files.createTempDirectory("", new FileAttribute<?>[] { }); but it did not help either.
I am using 32 bit JDK 7 on Windows 7 system. I am not local admin on the machine.
Has anybody come accross this?
UPDATE 1:
Files.createTempFile(this.tempDir.toPath(), "tmpFile", ""); seems to have the same problem.
As a workaround I have moved to com.google.common.io.Files.createTempDir().
Have you tried with
Files.createTempDirectory(null)instead ofFiles.createTempDirectory(""). In the documentation, you can read that it's possible pass the prefix as null object.https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#createTempDirectory-java.lang.String-java.nio.file.attribute.FileAttribute...-