Menu

#37 Ressources and property files

2.1.0rc2-RELEASE
open
nobody
None
1
2013-01-23
2013-01-18
christian
No

There are some issues with the classpath when you make an eclipse project. i.e. at RessourceManager.java : 147

public static Properties getAttrValuesProperties() {
    Properties properties = new Properties();
    try {
        //This will fail in eclipse: properties.load(ResourceManager.class.getResourceAsStream("resources/attrvalues.properties"));
            /*this will work*/
        Thread.currentThread().getContextClassLoader().getResourceAsStream("resources/attrvalues.properties");
    } catch (Exception e) {
        e.printStackTrace();
    }
    return properties;
}

But I am not able to get it work with either way with application-info.properties file.

I realy would like to see you using JConfig ( http://www.jconfig.org/ ). It is very robust and easy like a walk in a park. You will never have any classloader issues and get a lot of benefits like parameter grouping, default parameter (even if the config file is missing completely), parameter casting and more - right out of the box with one line of code.

Cheers
Chris

Discussion

  • Piotr Dyraga

    Piotr Dyraga - 2013-01-21
    • milestone: 2.1.0rc1-RELEASE --> 2.1.0rc2-RELEASE
     
  • christian

    christian - 2013-01-23

    please consult provided patch for issue 39

     

Log in to post a comment.