How to read files from a remote system using Java?

I have a file copied on one computer and I need to access the file from another computer

to update:

I'm using Ubuntu Linux Code I use:

File f = new File("//192.168.1.157/home/renjith/picture.jpg");// 192.168.1.157 is the ip of the computer,where I have the picture file
Image image = ImageIO.read(f);

But it is an exception:

javax.imageio.IIOException: Can't read input file!
    at javax.imageio.ImageIO.read(ImageIO.java:1275)

I also shared the renjith folder

Solution

There are several ways to access files on a remote machine, but they almost all depend on the remote machine being set up to provide files in some way If you access files through Java, the easiest way may be to set up an HTTP server on a remote machine (you can easily use the Apache HTTP server on various platforms), and then use the Apache Commons httpclient client Java application to further discuss how to install these or configure them. Generally, it is beyond the scope of stack overflow, and at least one more specific problem is required

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>