Resource Bundle Runtime Loading

Hi,

We created a desktop utility, using which:

1. we can create a new .properties file

or

2. we can open an already existing .properties file and modify the properties.

The files are read from a certain folder.

The problem that i am facing is,

I started the application, created a new .properties file using the applic. and saved it. while the application is still running, when i try to open the same file that was created, it is giving me MissingResouceException (obviously, becoz when the applic. was started this resource was not existing).

Is there any way, by which i can open the same Resource (for modifying) without shutting down the application ?.

[717 byte] By [petzua] at [2007-10-3 8:13:51]
# 1

> I started the application, created a new .properties

> file using the applic. and saved it. while the

> application is still running, when i try to open the

> same file that was created, it is giving me

> MissingResouceException (obviously, becoz when the

> applic. was started this resource was not existing).

Please post the entire StackTrace of Exceptions. I doubt that it has anything to do with the resouce not existing. I am going to make a while guess that it has something to do with not closing the file?

> Is there any way, by which i can open the same

> Resource (for modifying) without shutting down the

> application ?.

Yes, there must be something wrong in your code if you aren't able to now.

zadoka at 2007-7-15 3:18:41 > top of Java-index,Desktop,Developing for the Desktop...
# 2

Thanx for the reply.

This issue got resolved, i used PropertyResourceBundle's constructor, which accepts InputStream as input.

FileInputStream fin = null;

try

{

fin = new FileInputStream("Test1.properties");

PropertyResourceBundle res = new PropertyResourceBundle(fin);

}

catch (FileNotFoundException e)

{

e.printStackTrace();

}

catch (IOException e)

{

e.printStackTrace();

}

The above resource will always have the updated key-value pairs.

petzua at 2007-7-15 3:18:41 > top of Java-index,Desktop,Developing for the Desktop...