Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用java从经过身份验证的网络打开文件夹_Java_Smb - Fatal编程技术网

使用java从经过身份验证的网络打开文件夹

使用java从经过身份验证的网络打开文件夹,java,smb,Java,Smb,我想通过java打开远程机器上的文件夹。主要问题是远程机器具有身份验证。我一直在尝试使用 String url = "smb://10.xx.xx.xx/abc/"; NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, "username", "password"); SmbFile dir = new SmbFile(url, auth); 但我无法在窗口中显示该文件夹 这是正确的方法还是其他图书馆

我想通过java打开远程机器上的文件夹。主要问题是远程机器具有身份验证。我一直在尝试使用

String url = "smb://10.xx.xx.xx/abc/";

NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, "username",  "password");
SmbFile dir = new SmbFile(url, auth);
但我无法在窗口中显示该文件夹

这是正确的方法还是其他图书馆可能会有所帮助


简言之,我想显示文件夹,如
Desktop.getDesktop()。打开(文件)

尝试使用下面的代码片段,但确保您尝试访问的文件夹需要在网络上共享

String sharedPath = "smb://IPaddress/Content/";
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, "username", "password");
SmbFile dir = new SmbFile(sharedPath, auth);
System.out.println(dir.listFiles());
for (SmbFile f : dir.listFiles())
{
    System.out.println("Source file name is: " + f.getName());
}

........ 等待几天,当它将是如此容易的伪代码…:'(Desktop.getDesktop().open(file)您无法在窗口中打开文件夹。您提到的上述代码可用于通过身份验证访问文件夹以及读取或写入文件。