On Mar 14, 4:14 pm, Michael Rauscher <michlm...@gmx.de> wrote:
> mineshde...@gmail.com 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
assw...@9.182.198.145/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
URI uri = URI.create("file://username

assword@9.182.198.145/shared");
File file = new File(uri);
can you please help me out in this.
Thanks