i am getting two different result from almost same programs on winnt. program 1. String file = "C:\abc.txt"; File name = new File(file); if(name.isFile()) System.out.print("it is a file") else System.out.print("file does not exists") its out put is "file does not exists"
program 2. i use same code on JSP and get file path through fileDialog box and it outputs "file exists" why two different outputs ? ------------------
dear khasif, try hard coding the full path in your second code i.e via JSP,I think it should give u file not exists if if r not having any file by that name.Remember a file class object doest not creates a file but only captures the path leading to that file.If u want to create a file u need to use fileoutputstream or random acess,which internally may be happening when u r giving path by file dialogbox.