-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Paul,
Paul Hammes wrote: > i have to unzip a jar, contained in a war file. This jar file is > contained in the web-inf/lib directory. There are several images in > this jar and i want to unzip it to tomcat/webapp directory so the > browser can access the images directly. The process of unzipping > should be triggered by the automatic deploy of the war file by tomcat. I'm not sure if you can actually listen for "auto-deploy" events, but you can certainly listen for an "app is ready" events by using a ServletContextListener. When the context is initialized, you can open your JAR file like this: private static final String JAR = "/WEB-INF/lib/my.jar"; public void contextInitialized(ServletContextEvent evt) { InputStream in = null; JarInputStream jin = null; try { evt.getServletContext().getResourceAsStream(JAR); if(null != in) { jin = new JarInputStream(in); // Do whatever you need to do with your JAR file. } else { logger.warn("Can't open JAR file"); } } finally { if(null != jin) try { jin.close(); jin = in = null; } catch(IOException ioe) { logger.error(ioe); } if(null != in) try { in.close(); } catch(IOException ioe) { logger.error(ioe); } } } Don't forget to close that JAR file, even if you have to use the contextDestroyed if you need to hold the JAR file open for the life of the context. Just out of curiosity, why do you need to open your own JAR file? Hope that helps, - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGgnGX9CaO5/Lv0PARAik+AJ9G0m+e1pw6Dem6AAXzRggvFVx0OwCgscQz 8CzqNlPbjoKZbpgft5i+pag= =ECcl -----END PGP SIGNATURE----- --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]