different output from same code when using on JSP and when in a simple program
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   owais_ali
Posted On:   Tuesday, September 4, 2001 07:47 PM

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 its output is "it is a file" why two different outputs ?    More>>

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 its output is
"it is a file"


why two different outputs ?

   <<Less

Re: different output from same code when using on JSP and when in a simple program

Posted By:   John_Gallagher  
Posted On:   Sunday, November 11, 2001 08:18 PM

I would guess (I'm not certain but you can try this) that Java is not interpreting the '\' in your file String correctly. Try making it
String file = "C:\abc.txt";
and see if that works.
About | Sitemap | Contact