• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Finding files in war file...??

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic