Re: Some java help needed!

damar thapa <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
Hi,

It is me again.

I just found that "new BufferedReader(new FileReader("countries.txt")); 
" was not getting countries.txt file. It worked after providing the 
absolute directory of countries.txt file.

If I want to avoid the absolute directory, for the convenience of 
deployment in Tomcat, in which directory, should I place the 
countries.txt file?

Any pointer would be highly appreciated?

Damar



damar thapa wrote:

> Hi Martin,
>
> Thanks for your message.
>
> I now used ArrayList, instead of Array, and is working upto storing 
> lines into it. But,
>
> country.setListData(countryList.iterator()); part is still not working.
>
> Any other pointers?
>
> Damar
>
>
>
>
> Martin Paoletta wrote:
>
>> Hi,
>>
>> You need to initialize your array, probably doing something like:
>>
>> String[]  countryList = new String[10];
>>
>> But it's better to use a collection, like an ArrayList and do
>>
>> country.setListData(countryList.iterator());
>>
>> Hope it helps,
>> Martin
>>
>> -----Mensaje original-----
>> De: [email protected]
>> [mailto:[email protected]] En nombre de damar thapa
>> Enviado el: Viernes, 09 de Mayo de 2003 02:18 p.m.
>> Para: [email protected]
>> Asunto: [Barracuda] Some java help needed!
>>
>>
>> Hi,
>>
>> I have the following code:
>>
>>
>> else if (key.equals("Country")) {
>>                String[]  countryList;
>>        int i=0;
>>        try{
>>            BufferedReader in = new BufferedReader(new 
>> FileReader("countries.txt"));
>>            String str=null;
>>              while ((str= in.readLine())!=null){
>>                countryList[i++]=str;
>>            }
>>            in.close();
>>        } catch (IOException e){}
>>
>>        BSelect country = new BSelect();
>>                country.setListData(countryList);
>>                return country;
>>             }
>>   I am trying to read the list of countries from countries.txt file, 
>> put them in countryList (array of string), and send the list as 
>> parameter of
>>
>> setListData to the instance of BSelect.
>>
>> Seems, I cann't store them in array, any pointers?
>>
>> Thanks.
>>
>> Damar
>>
>> _______________________________________________
>> Barracuda mailing list
>> [email protected]
>> http://barracudamvc.org/lists/listinfo/barracuda
>>
>> _______________________________________________
>> Barracuda mailing list
>> [email protected]
>> http://barracudamvc.org/lists/listinfo/barracuda
>>
>>  
>>
>
>
> _______________________________________________
> Barracuda mailing list
> [email protected]
> http://barracudamvc.org/lists/listinfo/barracuda
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.