> From: Guimaraes, Patricia (NIH/NLM) [C] > [mailto:pguimar...@mail.nlm.nih.gov] > Subject: different behavior in processing jar files in Tomcat 5.0.28 > andTomcat 6.0.18 > > Essentially, when running my Java code which calls method > getResource(String name) of class Class to find a resource > that is part of a jar file, Tomcat 5.0.28 finds the jar > file in the classpath and expands it in directory jakarta-tomcat- > 5.0.28/work/Catalina/localhost/testapp/loader.
That's convenience behavior of the container, not defined by the spec. > And then I can access the resource in the expanded jar file > by calling the getPath() method on the instance of the URL > class returned by the getResource(String name) method. The container (Tomcat) is under no obligation to provide any access to the underlying file system (if there is one), other than temporary scratch space. Your use of URL.getPath() - presumably followed by some variation of new File(path) - is risky, and was never guaranteed to work. You should probably be using Class.getResourceAsStream(), which should function properly on any container. - Chuck P.S. Ignore Martin's response - it has no relevance to jars, just to .war files. THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org