I am trying to transfer a text file from server to client using File objects. but i am not getting success. so how can we transfer a text file without going into the Socket programming and streams.
Answer
In Java, a File Object simply represents a possibly existing file on the file system.
If you create a file object like this:
File f = new File ( "c:\\test.txt" );
and the file "c:\test.txt" doesn't exist, this will throw no exception (but f.exists ( ) will tell you so).
If you want to work with a file's content, you'll ask an InputStream for it, and only then you'll really access the file.
What you can do to solve your problem, is to read the file on the server side, store it's content (in a String, byte array, or whatever ...) and pass the content to the client.
This has to be done, because the remote machine can't access the local machine's file system.
This can be implemented by putting a method in you remote interface like this:
byte[] getFileContents ( String fileName ) throws RemoteException;
if you then implement this method on the serverside and return a byte array, you can write a new file on the client side, or keep the data in memory, according to your needs ...