how to access files over the network using java
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Friday, May 11, 2007 01:32 PM

I have two windows machines connected through LAN.
If both computers are on the same network, and it's a Windows network , I want to know how to read file placed in Shared folder/drive in machine2 by executing java program from machine1. The shared folder is public folder with full access to every one. Note that When I access the shared folder from my machine I am able to access the folder without giving any username/password.
Regards
Sivashankar P.

Re: how to access files over the network using java

Posted By:   Anonymous  
Posted On:   Monday, July 16, 2007 05:22 PM

In Java, you connect to a file on a shared directory path using a file location convention that is similar to what you would use in Windows Explorer (only the slashes are changed):


File someFile := new File("//hostName/shareName/dirPath/fileName");


Reading the file is left as an exercise for the reader.


Note: This solution is not platform-independent.

About | Sitemap | Contact