Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Find a file in system

  Asked By: Pedro    Date: Apr 19    Category: Java    Views: 591
  

I hope u people will solve my problem.I would like to read a file
from my system(local machine), file may be in any location.But I have file
name.
Ex. test.properties file .I need find out that file and load in to
properties.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Shobhana R.     Answered On: Apr 19

you can create a new instance of filereader
like
FileReader fr = new FileReader(..............) //complete syntax
see book/
and then use the command if
File f1 = new File("ex.test");
if f1.exists();

 
Answer #2    Answered By: Carl Woods     Answered On: Apr 19

If your doing this for a local html page, you can use JavaScript and ActiveX:

function getFile(filespec) {
var fso, f;
fso = new ActiveXObject("Scripting.FileSystemObject");
f = fso.GetFile(filespec);
return f;
}

Where filespec is an absolute or relative path to the specified file.
(Unless you set the current directory, the path will be relative to the
user's desktop)

 
Didn't find what you were looking for? Find more on Find a file in system Or get search suggestion and latest updates.




Tagged: