This article describes the method of Java programming to determine whether online neighbor files exist. Share it for your reference, as follows:
Since java does not support the path of passing //192.168.19.168/fz/OK/Zhang Lichen-Chinese Painting/jpg/ZLC-Yu1-X.jpg
If you need to map the path to the local disk, you can
package test;import java.io.File;public class FileCheck { /** * @param args */ public static void main(String[] args) { String filename="d://te st.xml"; filename=" o://test.xml"; filename="o://t"; filename="o://study//learning.txt"; File f=new File(filename); if (f.exists() ) { if (f.isFile()) { System.out.println("is file exist "); } else { System.out.println("is folder exist "); } } else { System.out.println( "no"); } System.out.println(checkFileExist(filename)); } public static boolean checkFileExist(String filename) { //String filename="d://test.xml "; //filename="o: //test.xml"; File f=new File(filename); if (f.exists()) { System.out.println("filename:"+filename+" exist"); return true; } else { System. out.println("filename:"+filename+" not exist"); return false; } }}I hope this article will be helpful to everyone's Java programming.