[Advanced-java] Share a folder of Remote PC Programatically ??

Bikash Paul bikashpaul_2001 at yahoo.com
Sat Aug 9 09:33:19 2003


Hi,

I want to share a folder of remote PC
Programatically(there is no network in between remote
PC and local PC) by creating a shortcut of that folder
on my local PC's desktop using internet
connection(modem dialing) so that I can manually copy
and paste file in that folder and my remote PC has
fixed IP(means public IP).For that Iam using RMI
technology now I am facing problem with my below
codes.Any help will be appreciated.

RemoteAccessImpl file:-

import java.io.*;
import java.util.*;

public class RemoteAccessImpl extends 

java.rmi.server.UnicastRemoteObject implements
RemoteAccess { 
 
    
    public RemoteAccessImpl() 
        throws java.rmi.RemoteException { 
        super(); 
    } 
 
    public void makeShortcut(String dir) 
        throws java.rmi.RemoteException {
        
        File file = new File(dir);
        if (file.isDirectory()){
        String[] list = file.list();        
        for (int i=0;i<list.length;i++){

 /*Iam confused here about the code should I read that
directory and write on Outputstream and make a
directory on local PC's desktop or read from client
interface and make a directory.Please guide me.*/

       }
   }        
 }     
}        

RemoteAccessClient:-

import java.rmi.Naming; 
import java.rmi.RemoteException; 
import java.net.MalformedURLException; 
import java.rmi.NotBoundException; 
 
public class RemoteAccessClient { 
 
    public static void main(String[] args) { 
        try { 
           RemoteAccess c = 

(RemoteAccess)Naming.lookup("rmi://172.169.0.16/RemoteAccessService");

        c.makeShortcut("C:\\ShareFolder\\");   
        } 
        catch (MalformedURLException murle) { 
            System.out.println(); 
            System.out.println(
              "MalformedURLException"); 
            System.out.println(murle); 
        } 
        catch (RemoteException re) { 
            System.out.println(); 
            System.out.println(
                        "RemoteException"); 
            System.out.println(re); 
        } 
        catch (NotBoundException nbe) { 
            System.out.println(); 
            System.out.println(
                       "NotBoundException"); 
            System.out.println(nbe); 
        } 
        
    } 
} 

Thanks & Regards
Bikash


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com