What will be the root context to refer to a properties file in the plugin jar? Any ideas anyone
Thank you, Phani Yadavalli -----Original Message----- From: Yadavalli, Phani [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 05, 2006 4:45 AM To: [email protected] Subject: How to load properties files inside plugins Hi, I have a file called env.properties embedded within the plug-in jar file. When I run the files outside the context of a plug-in, they run fine. But when I try to call the plug-in from another pom.xml I get the following problem [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> file not found hence cannot load -- listing properties -- -- listing properties -- -- listing properties - The code for above is dmpenvironment = loadProperties(is, log, "com/dmp/util/env.properties"); private static Properties loadProperties(InputStream is, Log log, String fileName) { Properties propFile = new Properties(); try { is = PropertyLoader.class.getResourceAsStream(fileName); System.out.println(PropertyLoader.class.getClassLoader().toString()); if (null != is) propFile.load(is); else System.out.println("file not found hence cannot load"); } catch (FileNotFoundException fnfe) { log.fatal("File not found : ", fnfe); fnfe.printStackTrace(); } catch (IOException ioe) { log.error("IOException while reading property files", ioe); ioe.printStackTrace(); } } public static String getEnvironmentProperty(String property) { dmpenvironment.list(System.out); return dmpenvironment.getProperty(property); } Thank you, Phani Yadavalli --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
