• Post Reply Bookmark Topic Watch Topic
  • New Topic

Properties  RSS feed

 
Richard West
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I have a question about the use of properties.

You see usually if you wanted to add a property you would do this



But the thing is i have heard now that this property class may be deprecated soon and people are now encouraged to use the ResourceBundle.

Here is the thing i am not very sure how to use the ResourceBundle class. I tried to yahoo but almost found no information on it. For example like the above code that i have, how does one convert that using the ResourceBundle class??

Any help is greatly appreciated

Thank You

Yours Sincerely

Richard West
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you heard of the Java API documentation? If not, you should bookmark it and learn how to navigate it. It is very handy for any Java programmer to get a quick overview of a class. In particular, you can look at the docs for ResourceBundle which contains an example of how to use it. Granted, the API docs aren't always a great tutorial, but they usually provide enough information to allow you to experiment and get the behavior you want.

I hope this helps.

Layne
 
Richard West
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

Sorry to ask this question but bear with me a while.

You see when you add a property to a program

for example say like that



Basically my question is that does the property still remain even after the program is exited or do all the JVM properties simply go back to default

Any help is greatly appreciated

Yours Sincerely

Richard West
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe that all the properties go back to the JVM defaults the next time you run this program. Personally, I don't add my custom properties to the system properties. I create my own empty Properties object and add them to it. I also use a file so that I can persist the properties between each time the program is run. The Properties class provides helpful methods to read and write to a file (or any stream, in fact).

Layne
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!