if you use domain then you have to use user variable like below,
String user = "domain;user:password";
else use below code,
String user = "user:password";
rest of the code should be like below,
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(user); String path = "smb://server/D/MyLocation/data.txt"; SmbFile sFile = new SmbFile(path, auth); SmbFileOutputStream sfos = new SmbFileOutputStream(sFile); sfos.write("Test".getBytes());
There you go, data.txt should be there in your locatoin :-)