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!

FileNotFoundException (No such file or directory) on file that exists

807601May 16 2008 — edited May 16 2008
Hello,

I am working on an app in Eclipse 3.3.2 using a MacBook (OS 10.4.11) that is trying to read a file that exists in the eclipse folder.
When the stack trace is received, I can cut and paste the filename into Firefox and retrieve the file which makes me wonder why
the program is not accessing the file OK.

Thanks for your assistance.

Garrett
        public void procSound(String soundfile) {

		  String filen;
		  filen = "file:///Users/teacher/Desktop/eclipse/ahooga.au";
	
		  File filein = new File(filen);
		  InputStream instrm=null;
                  try {instrm = new FileInputStream(filein);}
                 catch(IOException ie) {ie.printStackTrace(); }
java.io.FileNotFoundException: file:/Users/teacher/Desktop/eclipse/ahooga.au (No such file or directory)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at MouseEventHandler.procSound(Main.java:93)
	at MouseEventHandler.mouseClicked(Main.java:79)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 13 2008
Added on May 16 2008
2 comments
4,258 views