Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Manually adding java class files to a WAR file

 
Lawrence Gatson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been doing core java for awhile. I'm kind of new to web environment...

To be more specific new to generating WAR files.

My development environment is Windows, Eclipse and Tomcat.
Target environment is Unix and WebLogic.

I've updated and successfully tested 3 java classes and 1 JSP in an existing web application. Now I'm ready to build the war file and deploy it on the test environment on Unix.

The [grumpy] systems administrator instructed me to build the WAR file as follows (he is unaware if a Build.XML file exists):
1. In Windows, use the 7zip application to "browse/explore" into the [existing] WAR file
2. Drag and drop the updated class files and jsp file from Tomcat into the WAR file

The WAR file deployed on Weblogic, and the web app did came up, but the [JSP] page that I updated is not rendering. The sys admin is blaming my code, but I don't think that is the problem.

My question is: Is this a valid way update a WAR file?

Thanks, I just need validation. If this is a valid way to update a WAR file then I'll continue down this path.


 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a valid mechanism only if you don't screw it up by placing the files in the wrong location. I would use a slight modification to this process: rename the xxx.war file to xxx.zip, unzip it into en empty directory, copy the files to the correct directories, and then zip it back up (making sure that you don't accidentally make xxx the base directory!), and rename the xxx.zip file to xxx.war. I have done this often with JAR files when I want to change a single class.

Warning: if you do this, make sure you use standard zip compression, Java cannot handle some of the compression mechanisms provided by 7Zip (avoid any mechanism that claims to provide better compression).

Of course, using a standard build script to rebuild from source is always the preferred method.
 
Lawrence Gatson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the response; I'll continue down this path with your suggestions...I agree, I wish I could get my hands on the build script. -llg
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic