help regarding the .class file appending to existing .war file
Joined: May 12, 2011
Hi, Hope your doing good.I have a one Example.war file(consider).I want to do some changes .the changes made file was UserInfom.java.I build .class file of userInfo.java using ant(v.1.8.2).then I tired to append that .class file to the existing war file.i.e., Example.war using winzip. When ever I redeploy the war file..i cannot find any changes.escpecially the changes I have made..not even the static(html) part of it. Though it was a small change.I doubt the approach that I did for appending .class file.So I searched over net could not only one link.here is the link.:: http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/trun_app_hotupgrade_war.html The thing is …I am not able to understand the line…”If the .class file is part of a Jar file, you can place the new version of the Jar file directly in application_root/module_name/WEB-INF/lib.”
In Example.war file ,the WEB-INF/lib contains only three jar files(mysql-connector-java-5.0.7.jar,dmtpserv.jar,mail.jar)How can I replace the existing .jar files with new version.please help me if you any thing about it..
I work mostly in Unix/Linux environments, so I always use jar instead of zip.
Take a look at this: Update Jar File
I did also notice this waring about using zip:
JAR files are built on the ZIP file format. Computer users can create or extract JAR files using the jar command that comes with a JDK. They can also use zip tools to do so; however, caution should be exercised as to the order of entries in the zip file headers as the manifest likely needs to be first.
Ant also has a Jar Task, but I have never used it for just doing a simple update.
"Stay on the path."
Joined: May 12, 2011
Thanks a lot for your reply..
By using the cmd:jar uf track.war UserInfo.class
I can update the .class file to the .war file.but i need to add this .class file to web-inf\classes\org\opengts\war\track\page folder in .war file.I used -C optiopn to change the directory.Both the .war file and .class file are at same folder.Below error is coming when i run the jar cmd.
C:\Documents and Settings\Administrator\Desktop\keerthana\mydoc\new changes\18-5
-2011>jar uf track.war -C WEB-INF\classes\org\opengts\war\track\pages\ UserInfo
WEB-INF\classes\org\opengts\war\track\pages\UserInfo$FirstLogin.class : no such
file or directory
Try putting the war file in your context root (i.e. 1 directory up from WEB-INF, i.e. cd to WEB-INF then "cd ..")
Then put "UserInfo.class" AND IT'S COMPILED INNER CLASS "FirstLogin.class" in the "WEB-INF/classes/org/opengts/war/track/pages/" directory.
Question: Is it "track/page" OR is it "track/pages"?
Then jar -uf track.war WEB-INF/classes/org/opengts/war/track/pages/UserInfo.class
Check to see if all of your class files are in the right place by using "jar -tf track.war".