• Post Reply Bookmark Topic Watch Topic
  • New Topic

Finding files in war file...??  RSS feed

 
Mike Croteau
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand how to use File as well as File[] to retrieve file information on my PC given a specified directory. However, I would like to know if there was a way to find a file which I have located within a web-application which could be installed on many different directories. I am using tomcat5 and could use the same logic as I did previously, but tomcat5 could lie on a much different directory if I installed my web application else where. Is there a work around? I apologize if this post is convoluted...

Any information on this would be most helpful. Thank you in advance!!!

Sincerely,
Mike
 
John Melton
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike,
Your post is somewhat convoluted. I'll try my best. If you want to look through a war file for a particular file, that's fairly easy. A war file is just a zip file with some special attributes. If you'd like to do that, just search google for "read zip files java" and you should get some good info. If that doesn't help, try to describe in more detail what you're trying to do and I'll try something else.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15862
81
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact, a WAR file is just a JAR file. Have a look at the documentation of the package java.util.jar for information on how to handle JAR files from within your Java application.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to read files on a web server where the WAR file has been exploded (unzipped) into a bunch of folders, the challenge may be finding where they were unzipped. Frankly, I don't remember the best way and I'm away from my resources where I could look for an example. Somebody chime in with how to find files from code running in a servlet container?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!