• 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

How to edit a war file for a JSP ?

 
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello friends,
How to edit a war file for a jsp ? like.. replace one that is existing ?
Thank you in advance for your help.
Leena
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A "war" file is just a "jar" filw with specific contents. And a "jar" file is essentially just a "zip" file.
So you can edit a "war" file by expanding it out to a directory structure using the "jar" command from your java SDK, or you can edit it in-situ using something such as WinZip".
What do you need to do to this war file ?
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Am I the only Java developer that finds that that editing WAR files is one of the most tedious, error-prone tasks around?

It doesn't seem like what I want is THAT difficult... I want to open the WAR file with some utility (that looks suspiciously like WinZip), find a file thats contained therein, for example a log4j.properties file, double click on it to open it in notepad, make a few changes, close the window, and find that - voila! - the properties file is back safe and snug in the WAR file, neatly edited, but without any of the precious path information
having been hideously munged, and without the painful process of unpacking and repacking the whole thing.

Maybe I just suffer from WinZipaphobia, but it just seems to me something I need to do CONSTANTLY shouldn't be so difficult!

Responses desperately craved.

AtDhVaAnNkCsE
-V
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

I'll ignore the thread hijack, and just point out that Ant makes it easy to create WAR files. No need to un-war the file - just edit whichever file you need to edit, do a quick "ant war" from the command line, and -presto!- you've got a new one.
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have never edted a war file in over 7 years of writing web apps. I just recreate it from sources using Ant as Ulf stated.
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No doubt that there exists build files to make the compilation , building war and deploying in server for you to save development time.

But Leena , if you are curious as how can you change some jsp in a WAR and then again make a WAR of it and then deploy , then as Frank has already mentioned that you can use WinZip for unwarring it and then use jar utility of JDK for making a WAR (which is nothing but a jar).
 
Vershana Amarula
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Glad to be here! I've been lurking since I came here for pointers on the Java Developer cert I took last year.

I didn't mean to hijack. I guess I assumed that one suitable reply to the original poster would be a tool that makes replacing a jsp or other file easier.

As a support developer, I have access to Ant, etc., but a build on our software isn't always instant, because the svn repository is overseas. There is no doubt that at some point, the source needs to be updated and a new war file generated, at least if the change is one that is supposed to become permanent, so, point(s) taken.

Maybe its a working style thing. I often find that we need to make changes on the fly to configuration files and such in the war file for specific customer configurations that we are either testing, or shipping out as fixes.

For the support folks in the field, either I have to tweak the war file for them for a specific customer situation, or educate them about unpacking, changing and repacking. These changes are always one-off, and will never go into a source tree. Asking the field folks to set up a development environment isn't really an option. However, they may find they need to make the change several times for other customers with similar issues.

Since Winzip is such a defacto tool for war file manipulation, I'm surprised they've never added such a feature. I'd be even more surprised if no one else has developed somethign to do this, though.

Please, I KNOW that changing config files in the war file is NOT a user-friendly way of doing things. When central development gives us lemons... :-)

-V
 
Vershana Amarula
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I will be happy to start a new thread, if this discussion isn't appropriate here.

I noticed that the first person to reply in this thread (in 2002) said that Winzip could be used to edit a WAR file "in situ". I'm not familiar with how to do this. Can anyone provide details (other than unpacking everything, changing a file, and repacking everything)?

Rahul, you say there must be utilities out there. You don't happen to know of any specific ones, do you?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vershana, if you're looking for a command-line tool, you can use jar. It has the "u" option, which updates one or more files within the jar file.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic