2

I'm having some troubles in finding how to manage network credentials while writing file into my java application which is running on Tomcat on Windows Server 2012 R2.

What I need to do is write a file into a network folder with

import java.nio.file.Files;
//[...]
Files.write("//serverIp/serverFolder/fileName.xxx, fileToWrite);

but I need to do that with a specific username and password, which are specific for that use and with no password expiration, and different from the one used by Tomcat or the OS .

If not specified, I'm ofc getting java.nio.file.AccessDeniedException: [...]

I found that is possible with external libraries in others questions (like https://stackoverflow.com/a/2171964/1984767 ) , but I prefer to stick to standard java whenever is possible.

Is that possible?

Leviand
  • 2,745
  • 4
  • 29
  • 43

0 Answers0