Loading
FileNotFound

Java Quick Notes

Refresh Your Java - Before Java Interview

We are Agile, believe in less Documentation - Only Quick notes (Java Interview Questions) of Java/J2ee Read more....


Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet
Not Included Yet

Go to SiteMap

Q)  When you could encounter "FileNotFound" Exception? How to solve ?


Ans)

Solution depends upon the way you read the file.

i) If you are using Java IO package, please make sure that File exists in given file Path
and also share the Folder (if that is on a remote system) in which you have the file
and make sure that is accessible to JVM.
 
ii) If you are trying to read a File as Resource, please follow the following two steps.

 a) Add the file (Folder which contains the Folder) to the class path.

 b) Use getClassLoader to load this class as shown below.


 getClass().getClassLoader().getResource("Configuration.properties").getFile();



Back to top

------------------------- We hope you got necessary Info On -----------------------------------------

FileNotFound


FileNotFound

-------------------------------------------------------------------------------------------------------



Face Book
Request for a Mock Interview/Training

Get a PDF

Face Book
Same look (Read) on any device, this is Ads free