[jboss-user] [Beginners Corner] - Re: How to access property files

prakashg do-not-reply at jboss.com
Mon Nov 20 02:38:44 EST 2006


	private static LoadConfig loadConfig = new LoadConfig();
	private Class ldClass = null;
	private final String PROP_FILE_NAME = "config.properties"; 
	private Properties prop = new Properties();
	private LoadConfig()
	{
		try {
			prop.load(Thread.currentThread().getContextClassLoader()
			        .getResourceAsStream(PROP_FILE_NAME));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public String getFilePath()
	{
		return this.prop.getProperty("XML_PATH");
	}
	
	public String getResultPath()
	{
		return this.prop.getProperty("RESULT_PATH");
	}
	
	public static LoadConfig getConfig(){
		return loadConfig;
	}

This is the code , I added the property file to the class path by editing configure buil path tab in eclipse, thanks for your reply


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3987225#3987225

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3987225



More information about the jboss-user mailing list