Re: FileInputStream returns FileNotFoundException on Apple Mac
From: Jacqueline Snook (jasnook_at_ntlworld.com)
Date: 05/16/04
- Next message: perry: "Re: Java Validation"
- Previous message: Alex Cejka: "to edit a .txt file on a server"
- In reply to: Chris: "Re: FileInputStream returns FileNotFoundException on Apple Mac"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 16 May 2004 04:52:30 -0700
Thanks a bunch guys!! I have sorted that problem out now - time to
move on to the next one!!!
(to 10 green bottles)
99 bugs in the program,
99 bugs,
Take one out compile it again,
Now there is 100 bugs in the program!!
sarge_chris@hotmail.com (Chris) wrote in message news:<568394b1.0405120413.71fc3cbe@posting.google.com>...
> > I am trying to reference a file on an apple mac from Java. In order
> > to find what the URL is supposed to be, I opened it in the Safari web
> > browser. The directory as returned was
> > file:///Users/networkserver/SmartAV-CMS/smartav.properties.
> >
> > When I give this as a String reference to FileInputStream in Java, it
> > returns a FileNotFoundException, quoting
> > "file:/Users/networkserver/SmartAV-CMS/smartav.properties (No such
> > file or directory).
> >
> > I would like to know how to reference this file, and also maybe why it
> > takes out 2 of the slashes.
>
> FileInputDevice assumes the string argument is a file-path whereas
> you're assuming it's an URL. Either pass in just the file-path (i.e.
> omit 'file://' from the start) or check out the URL class (you can get
> a File object or InputStream from an URL).
>
> Incidentally that's why it strips out the two slashes from the start
> of the URL - it automatically removes what are considered as
> superfluous separators in the path.
>
> - sarge
- Next message: perry: "Re: Java Validation"
- Previous message: Alex Cejka: "to edit a .txt file on a server"
- In reply to: Chris: "Re: FileInputStream returns FileNotFoundException on Apple Mac"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|