Need help with LAN browsing

Hi all.

I have a simple problem. I written an algorythm to make a list of files and directories in a path:

It has 2 classes.

In NetworkList.java:

package myprojects.networklist;

import java.awt.*;

import java.awt.event.*;

import myprojects.Directory.*;

import java.util.ArrayList;

class NetworkList extends Frame

{

public NetworkList()

{

addWindowListener(new WindowAdapter()

{

public void windowClosing(WindowEvent e)

{

dispose();

System.exit(0);

}

});

}

public static void main(String args[])

{

System.out.println("Starting NetworkList...");

NetworkList mainFrame = new NetworkList();

mainFrame.setSize(400, 400);

mainFrame.setTitle("NetworkList");

mainFrame.setVisible(true);

System.out.println("Listing files and folders...");

ArrayList l = new ArrayList();

Directory dir = new Directory("f:\\incoming", l);

}

}

In Directory.java:

package myprojects.Directory;

import java.io.File;

import java.util.ArrayList;

import java.lang.String;

public class Directory extends File

{

private String thisPath;

public Directory(String path, ArrayList l)

{

super(path);

thisPath = path;

getContents(l);

}

private void getContents(ArrayList l)

{

if (!this.isDirectory()) return;

Directory d;

String buffer[] = this.list();

for (int i = 0; i < buffer.length; i++)

{

System.out.println(thisPath+"\\"+buffer);

l.add(thisPath+"\\"+buffer);

}

for (int i = 0; i < buffer.length; i++)

if (buffer != "." && buffer != ".." ) d = new Directory(thisPath+"\\"+buffer, l);

}

}

It works correctly, but I want to make this code works on LAN, to make a list of shared things on a computer. (for example I want to make a list of files and directories at \\193.225.227.32)

Please help me solve this problem.

Thaks.

[2126 byte] By [MonsterHuna] at [2007-9-28 12:46:11]
# 1
If I understand the question you are referring to something that only exists on windows. Since it is OS specific you will need to use an OS specific solution which means either Runtime.exec() or JNI. And I would guess for this that you are going to have to use the second.
jschella at 2007-7-12 8:24:36 > top of Java-index,Other Topics,Algorithms...
# 2
This might help you: http://jcifs.samba.org/
BIJa at 2007-7-12 8:24:36 > top of Java-index,Other Topics,Algorithms...