Java smb/获取远程共享文件夹

1.远程文件夹不需要用户名和密码

public static void main(String[]args) throws Exception {
	
		System.setProperty("jcifs.smb.client.dfs.disabled", "true");
	       
		SmbFile file = new SmbFile("smb://192.168.66.133/Share/");
		
		SmbFile[] files=file.listFiles();
		for (SmbFile smbFile : files) {
			System.out.println(smbFile.getName());
		}
		
		String [] ss=file.list();
		for (String string : ss) {
			System.out.println(string);
		}
	}

2.远程文件夹需要用户名和密码

UniAddress dc = UniAddress.getByName("ip地址");  
NtlmPasswordAuthentication authentication = new NtlmPasswordAuthentication("", "", "");  
SmbSession.logon(dc, authentication);  
SmbFile file = new SmbFile("地址",  authentication);