This is quite tricky issue. I use the following method. Basically it locate the directory where you place your designated class definition!
============================================ static String base; static { try { // use an object instance which is part of service! my.package.MyObject rm = new my.package.MyObject(); Class c = rm.getClass(); String name = "my.package.MyObject.class"; URL url = c.getClassLoader().getResource(name); String st1 = url.getPath(); int x = st1.indexOf("file:"); // remvie "jar:file:" part; if (x>=0) st1 = st1.substring(x+5); x = st1.indexOf(":"); // remove leading "/" for Windows! if (x>=0) st1 = st1.substring(1); st1 = st1.substring(0, st1.length()-name.length()-1); // remove /class name; if (st1.endsWith("!")) { // remove jar/war/aar/mar file paths; x = st1.lastIndexOf("/"); if (x>=0) st1 = st1.substring(0, x); } st1 = st1.replace("/", File.separator); // directory; base = st1+File.separator; System.out.println("Base: "+base); } catch (Throwable t1) { t1.printStackTrace(); } } -- View this message in context: http://www.nabble.com/Read-and-write-inside-WEB-INF-tf4078368.html#a11597896 Sent from the Tomcat - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]