2012-02-09 5 views
1

私はいくつかの共有フォルダを持つサーバーを持っています。私は彼らの名前、ちょうどipaddressを知らない。 マイ・トライアル:リモートサーバー上のすべての共有ディレクトリを取得

File rootFolder = new File(rootFolderPath); 
String[] strings = rootFolder.list(); 

did not work。

Javaでは、ネットワーク共有上のすべての共有フォルダを取得する方法はありますか?

+0

http://stackoverflow.com/questions/3830847/how-to-get-all-the-shared-folders-in-windows-xp-参照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 

参照しますusing-java –

+0

共有フォルダはコードと同じオペレーティングシステムですか? –

+0

そうは思わない。 私は窓にいる、これはNASです – jussi

答えて

1

JCIFS SMBクライアントライブラリを使用すると、Javaアプリケーションは、NetBIOS over TCP/IPネットワークのドメイン、ワークグループ、およびサーバーの列挙に加えて、SMBファイルサーバー上の共有ファイルおよびディレクトリ(Microsoft Windowsの「共有」)にリモートでアクセスできます。

http://jcifs.samba.org/src/docs/api/jcifs/smb/SmbFile.html#list%28%29

+0

これは試しました。 SMBの0ファイル/ディレクトリを返します – jussi