"Before software can be reusable it first has to be usable"- Ralph Johnson

Sunday, September 18, 2011

Simplest Way To Connect To A Shared Folder in Windows With Java

By 10:08 AM
Sometimes we usually meet a situation like, we want to access a shared folder in windows environment remotely. So this is one of the simplest way to do so :-
    File file = new File("\\\\theRemoteIP\\webapps"); 
    File[] files = file.listFiles();  
    System.out.println("Access granted");  

    for (int i = 0; i < files.length; i++)  
    {  
        String fname = files[i].getName();  
        System.out.println(fname);  
    }

0 comments:

Post a Comment