protected final Properties loadProperties ( String filename ) { Properties ret = new Properties ( ) ; URL url = null ; File f = new File ( filename . toString ( ) ) ; if ( f . exists ( ) ) { try { url = f . toURI ( ) . toURL ( ) ; } catch ( Exception ignore ) { } } else { ClassLoader loader = Thread . currentThread ( ) . getContextClassLoader ( ) ; url = loader . getResource ( filename ) ; if ( url == null ) { loader = Gen_RunScripts . class . getClassLoader ( ) ; url = loader . getResource ( filename ) ; } } try { ret . load ( url . openStream ( ) ) ; } catch ( IOException e ) { System . err . println ( this . getAppName ( ) + ": cannot load property file <" + filename + ">, IO exception\n--><" + e + ">" ) ; } catch ( Exception e ) { System . err . println ( this . getAppName ( ) + ": cannot load property file <" + filename + ">, general exception\n--><" + e + ">" ) ; } return ret ; }
Loads properties from a file .