src/main/java/de/vandermeer/execs/Gen_RunScripts.java
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;
	}
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;
	}
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.
@param filename property file loaded from class path or file system
@return loaded properties, null if nothing could be loaded plus error messages to standard error if exceptions are caught
Loads properties from a file .