Read a text file kept outside the .jar file

A

arvind

Hi,
i want to read a normal text file kept outside my .jar file from my
jar file.

i have tried using InputStrem.

But it didn't work.

how can i do it?

Thx in advanne.
 
B

Boaz.Jan

arvind כתב:
Hi,
i want to read a normal text file kept outside my .jar file from my
jar file.

i have tried using InputStrem.

But it didn't work.

how can i do it?

Thx in advanne.


java.io.File f = new File("YOUR FULL PATH HERE");
if (f.exists)
{
BufferedReader in = new BufferedReader(new FileReader(f));
}

for reading bytes instead of chars use FileInputStream istead of
FileReader or use any reader you want...
the BufferedReader class only encapsulate your reader and gives it
buffer capabilties and sopme sevrel methods...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top