• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading a file  RSS feed

 
vinayak jog
Ranch Hand
Posts: 83
MySQL Database Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


This code is giving file not found exception
where could have i possibly gone wrong ?? file already exists in the given path
java.io.FileNotFoundException: C:\Users\vinayak\Desktop\scr_nonprofit_367x206.jpeg (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileInputStream.<init>(FileInputStream.java:66)
at FRead.main(FRead.java:19)

 
Luigi Plinge
Ranch Hand
Posts: 441
IntelliJ IDE Scala Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you absolutely sure the file exists? Have you tried copy and pasting the path from the error message into a command line session after a dir command?

If so, are you running Java from a path that has permissions to see this folder?
 
vinayak jog
Ranch Hand
Posts: 83
MySQL Database Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
File does exists on the desktop so i suppose all processes have permission.. and even i pasted the file in the project folder tried to access it is showing the same error . i m using windows 7 and the netbeans ide ... i turned off the firewall also.. and i have admin privilages also... what could have gone wrong
 
Luigi Plinge
Ranch Hand
Posts: 441
IntelliJ IDE Scala Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried your code in Netbeans with a file on my desktop and it didn't throw an error. (Using XP.)
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure that the extension of the file is "jpeg" and not "jpg"?

If you open a command prompt and type this: dir C:\Users\vinayak\Desktop then do you see the file with the correct name in the directory listing?
 
vinayak jog
Ranch Hand
Posts: 83
MySQL Database Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya jasper it was "JPEG" i typed "jpeg" so was the error it is resolved now thanks for the clue.... thanks to every one who responded
 
Rob Spoor
Sheriff
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's odd; Windows shouldn't care about uppercase or lowercase.
 
abhay jain
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes , there is no side-effect from upper and lowercase characters .....strange
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!