reading in from a properties file

what is wrong with this code, it works fine when i put in the following "." as in the current directory

 inLine = new BufferedReader(new FileReader("properties.ini"));
                     inLine.readLine();
                     String location = inLine.readLine();
                     String fileName = processDir(new File(location));
                     System.out.println( "reading from " + location);

where properties.ini contains:

c:\test\mytest\

it fails on the line String fileName = processDir(new File(location));


giving an array index out of bounds exceptions. but it works fine if i manually put in "." in

  String fileName = processDir(new File(".")); or if i put in the properties.ini file:
.
 This program has to run on both windows and unix, so solution will have to be platform indepedent.

imramaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kiranhkCommented:
what is processDir(new File(location)); doing??
what error are you getting??
can you post your full code then we can have a look and tell u if anything needs to be changed???

also you can check out these examples

http://mindprod.com/fileio.html

http://www.javaalmanac.com/egs/java.io/pkg.html


http://www.idevelopment.info/data/Programming/java/PROGRAMMING_Java_Programming.shtml




0
CEHJCommented:
>>giving an array index out of bounds exception

Please post that
0
pronaneCommented:
its a problem with your processDir file, why not use a properties file to read in teh directory.

Are you sure that whatever the element u are using in the processDir is calling the current files
.getName() method???  if you are using

filename.getName();  it will just get the current name of the file in the current directory
however if you are using
filename.toString(); it will return the whole path of the file, just something to think about as "."  is the current directory,

hope that helps
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
imramaAuthor Commented:
ya i used getName() instead and it worked thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.