DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Properties

  1. #1
    Join Date
    Oct 2004

    Question Properties

    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

    Properties systemProperties = System.getProperties();
    systemProperties.setProperty("http.proxyHost", proxy);
    systemProperties.setProperty("http.proxyPort", port);
    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

  2. #2
    Join Date
    May 2005
    Denmark / Copenhagen
    A way to use ResourceBoundle is to create a java property file (with the extension properties). In this file you can write the properties like:
    PropertyName = PropertyValue

    You can then access these property from your code like:
    // Key is the PropertyName
    public static String getDefaultProperty(String key){
    String prop = null;
    ResourceBundle resource = ResourceBundle.getBundle(NameOfThePROPERTYFILE_WithNoExtension);
    prop = resource.getString(key);
    }catch(MissingResourceException e){
    //missing prop
    return prop; //prop is the PropertyValue

    Hope this will help you.

    Per Mikkelsen

Similar Threads

  1. Replies: 1
    Last Post: 03-15-2002, 12:22 PM
  2. Replies: 0
    Last Post: 02-12-2002, 06:04 AM
  3. Replies: 0
    Last Post: 02-08-2002, 06:25 PM
  4. Reading file properties
    By Millard Melnyk in forum VB Classic
    Replies: 6
    Last Post: 06-02-2000, 03:55 PM
  5. Reading file properties
    By Millard Melnyk in forum VB Classic
    Replies: 0
    Last Post: 06-02-2000, 12:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.