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

Forum statistics

Threads
474,262
Messages
2,571,049
Members
48,769
Latest member
Clifft

Latest Threads

Top