I have a WD My Cloud at home. I can access it with my laptop from the file explorer just by typing Z:\path\to\image.jpg
.
I'm writing a Java program that would read the image content located on this little cloud.
Here is my code:
Path p =Paths.get("\\\\192.168.1.2\\z$\\path\\to\\image.jpg");
try {
byte[] data = Files.readAllBytes(p);
// Process data here...
} catch (IOException e) {
// ...
}
This program fails with the below exception :
java.nio.file.FileSystemException: \\192.168.1.2\z$\path\to\image.jpg: Nom de réseau introuvable.
"Nom de réseau introuvable" : “Network name not found”
I tried other paths without success:
- \\localhost\z$\path\to\image.jpg
- \\127.0.0.1\z$\path\to\image.jpg
- \\MyPcName-PC\z$\path\to\image.jpg
- Z:/path/to/image.jpg
What am I missing ?
Windows 10
Java 8