Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java file path under windows

807601Jan 19 2008 — edited Jan 19 2008
Hi guys,

I'm having real trouble getting Java to find my file under Windows. I tried loads of things, but it kept giving me an IOException, so as a basic test, I did :
		java.io.File file = new java.io.File("file:///D:/rss.xml");
		if(file.exists()) {
			System.out.println("true");
		} else {
			System.out.println("false");
		}
However, no matter what combination of strings i try for the File constructor, I can't get it to print true! What am I doing wrong?

The file's definitely there by the way!!

Many thanks,
Nick Moores
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 16 2008
Added on Jan 19 2008
8 comments
931 views