Hi Omar Try using the classloader to load your properties file from the classpath (if you drop it in the classes directory or another jar-file)
try { is = Configuration.class.getClassLoader().getResourceAsStream("config.xml"); } catch (Exception e) { } The other way would be to use a relative path. As I recall all relative paths are relative to the WEB-INF directory of your webapp. (I hope I'm correct with this) I have used both ways successfully. I wouln't recommend using absolute paths and load resources entirely outside your application since some Servlet containers might restrict access to those files and maybe the user, the servlet engine is running under has no access to any files outside. Regards, Chris [ c h r i s t o f e r d u t z ] IT-Berater univativ GmbH & Co. KG Robert-Bosch-Str. 7, 64293 Darmstadt fon: 0 61 51 / 66 717 - 21 fax: 0 61 51 / 66 717 - 29 email: [EMAIL PROTECTED] http://www.univativ.de Darmstadt, Stuttgart, Karlsruhe, Düsseldorf -----Ursprüngliche Nachricht----- Von: Omar Adobati [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 19. Oktober 2006 15:45 An: users@cocoon.apache.org Betreff: Loading a configuration file from a jar Good Morning, I have developed a jar file and I need to load some configuration parameters from a .properties file placed outside of the jar itself. The jar file is under $cocoon/WEB-INF/lib directory and the .properties file too. Now, the problem is that my own class (that extends the java.util.Properties class) can't locate the properties file. Here is the code I'm actually using: public ConfigUtility(){ super(); File configFile = new File("/nptl.im.properties"); try{ configURL = configFile.toURL(); }catch (Exception ex){ ex.printStackTrace(); } //do some other useful stuff } I'm running cocoon 2.1.18 with tomcat 5.5.x and JDK 1.5 Thanks for your help :) -- Omar Adobati --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]