複数の共有フォルダーを持つサーバーがあります。私は彼らの名前を知りません。IPアドレスだけです。私の最初の試み:
File rootFolder = new File(rootFolderPath);
String[] strings = rootFolder.list();
動作しませんでした。
では、Javaでネットワーク共有上のすべての共有フォルダーを取得する方法はありますか?
複数の共有フォルダーを持つサーバーがあります。私は彼らの名前を知りません。IPアドレスだけです。私の最初の試み:
File rootFolder = new File(rootFolderPath);
String[] strings = rootFolder.list();
動作しませんでした。
では、Javaでネットワーク共有上のすべての共有フォルダーを取得する方法はありますか?
JCIFS SMB クライアント ライブラリを使用すると、Java アプリケーションは、ドメイン、ワークグループ、および TCP/IP ネットワーク上の NetBIOS のサーバー列挙に加えて、SMB ファイル サーバー (つまり、Microsoft Windows の「共有」) 上の共有ファイルおよびディレクトリにリモート アクセスできます。
http://jcifs.samba.org/src/docs/api/を参照
public java.lang.String[] list()
throws SmbException
List the contents of this SMB resource. The list returned by this method will be;
files and directories contained within this resource if the resource is a normal disk file directory,
all available NetBIOS workgroups or domains if this resource is the top level URL smb://,
all servers registered as members of a NetBIOS workgroup if this resource refers to a workgroup in a smb://workgroup/ URL,
all browseable shares of a server including printers, IPC services, or disk volumes if this resource is a server URL in the form smb://server/,
or null if the resource cannot be resolved.
Returns:
A String[] array of files and directories, workgroups, servers, or shares depending on the context of the resource URL
Throws:
SmbException
http://jcifs.samba.org/src/docs/api/jcifs/smb/SmbFile.html#list%28%29を参照