Venkat Natarajan wrote:I want my java program to search for my image file and find the path to it. How do I do this? Please tell me whether there exists such a method so as to do this.
If you mean to search a specific filename (or a more generic
pattern, e.g. all .txt files) in one directory or in a directory tree, you have to use the list/listFiles methods in java.io.File class. It's not immediate .. these methods give you an array of
String or File, you have to scan this array, verify each filename, etc... If you want to search on a tree of directories, you have to use recursion.
However, please clarify your final objective (in other words: why you are needing this).