i have a problem when i try to move a file to a shared folder in win xp.
My code is the next
import jcifs.smb.SmbFile;
import jcifs.smb.SmbFileOutputStream;
import java.io.File;
import java.io.FileInputStream;;
public class UnidadRed {
//public static void main(File enviado) throws Exception {
public static void main(String arg[]) throws Exception {
String enviado = "C:\\Documents and Settings\\u2d8301\\Escritorio\\probando\\estadisticas.txt";
String salida = "smb://172.22.224.64/Color";
//Config.setProperty("jcifs.smb.client.domain", "NTDOMAIN");
Config.setProperty( "jcifs.smb.client.username", "name");
Config.setProperty( "jcifs.smb.client.password", "password");
//Config.setProperty( "jcifs.netbios.wins", "172.22.224.64");
System.out.println("Copiando fichero ''" + enviado + "'' a ''" +salida + "''");
try {
FileInputStream in = new FileInputStream(enviado);
SmbFileOutputStream out = new SmbFileOutputStream(salida);
byte[] buf = new byte[1024 * 16];
int len, total=0;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
total+=len;
}
in.close();
out.close();
System.out.println(total + " bytes copiados.");
} catch (Exception e) {
e.printStackTrace();
}
}
}
I try to move a txt to a folder that will print automatically the file, when i execute appears the next failures:
Copiando fichero ''C:\Documents and Settings\u2d8301\Escritorio\probando \estadisticas.txt'' a ''smb://172.22.224.64/Color''
jcifs.smb.SmbException: Access is denied.
at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:563)
at jcifs.smb.SmbTransport.send(SmbTransport.java:663)
at jcifs.smb.SmbSession.send(SmbSession.java:238)
at jcifs.smb.SmbTree.send(SmbTree.java:119)
at jcifs.smb.SmbFile.send(SmbFile.java:775)
at jcifs.smb.SmbFile.open0(SmbFile.java:989)
at jcifs.smb.SmbFile.open(SmbFile.java:1006)
at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:142)
at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:97)
at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:82)
at jcifs.smb.SmbFileOutputStream.<init>(SmbFileOutputStream.java:54)
at apliSep.UnidadRed.main(UnidadRed.java:25)
I put correctly the name and password, because if a try a non valid login/password apperas a different message.
The my question is:
Is it neccesary other parametres in config.setProperty?
Thank you for all.