Re: Reading a file from another machine on the network



On Mar 14, 5:53 pm, Michael Rauscher <michlm...@xxxxxx> wrote:
mineshde...@xxxxxxxxx schrieb:





On Mar 14, 4:14 pm, Michael Rauscher <michlm...@xxxxxx> wrote:
mineshde...@xxxxxxxxx schrieb:

Hello,
I have a requirement in which i want to read a file from another
machine in the network. And also the machine is password protected.
Which protocol?

Can any one help me out in this.
I tried doing it in following way,
URI uri = URI.create("file://9.182.198.145/shared");
File file = new File(uri);
As i excute this code i get an exception as:
java.lang.IllegalArgumentException: URI has an authority component
Seems like the above is treated as UNC name which can't be used accross
platforms. E. g. Linux would look for a file 'shared' in directory
'9.182.198.145'.

Under windows you might want to try
"file://username:passw...@xxxxxxxxxxxxx/shared"

but perhaps it's easier to mount the share via

net use X: \\9.182.198.145\Shared <password> /user:<username>

and then access the file via X: ;)

Bye
Michael

Michael Thanks for reply,

I will explain you the requirement,

I have few machines on the network, i want to access a file under
"shared" folder on the machine with i.p address as 9.182.198.145

and all the systems have windows OS.

One more thing i tried with following code and i got the same
exception

Sorry, I was wrong.

Either you've got access to the Share, then you can simply use the UNC
name (\\9.182.198.145\Shared). Otherwise I thinkg you'd have to map the
Share to a drive letter or to have a look athttp://jcifs.samba.org;)

Bye
Michael- Hide quoted text -

- Show quoted text -

Correct me if iam wrong...

I have to Map the shared folder on my system then use the drive name
give to the mapped folder in file constructor.

Secondly,

Shared folder is password protected, so now what should be done?

Thanks
Minesh

.



Relevant Pages

  • Lost connection to shared drive/computer after install Win XP
    ... I was connecting to a PC over a local LAN using the the NET USE command ... bat file to map a shared folder, or I could also connect via My Network ... Places in Windows 2000 and map the drive from there. ...
    (comp.security.firewalls)
  • Re: Access Permissions
    ... In order to map the drive...they had to supply credentials, user name and password, correct? ... for that period during which they are powered up...they've entered credentials which allow them to browse ... user is able to browse any shared folder in addition to the one that was ... network places, the shared folders are still visible. ...
    (microsoft.public.windows.server.sbs)
  • Re: map some directories to 1 letter
    ... If I understand you correctly you wan to map several directories to one ... map the drive letter to that shared folder. ...
    (microsoft.public.windows.server.active_directory)
  • Re: 2003 sharing files with other 2003 server
    ... is map a network drive to a specific shared folder on the other server, ... a message saying that i don't have access to them because the "Username ...
    (microsoft.public.windows.server.general)
  • Unable to map drive letter
    ... I need to map a drive letter from a shared folder on my File Server. ... using all available letters in my workstation. ...
    (microsoft.public.win2000.file_system)