Hi, What are the uses of having JAR, WAR and EAR (some other is there??) I know about JAR file. As far my knowledge the JAR file is used when we want to give our application to the cilent, by placing all the class files with one manifest file stating which one has the main method.
Correct me if I am wrong. Please tell about WAR and EAR? Why there are using? Where it is frequently used? How to WAR or EAR? How to retireve the files from WAR and EAR(I don't know whether it has files like JAR)
Hi Sachin, JAR - Java Archive - for standalone applications WAR - Web Archive - for web applications EAR - Enterprise Archive - for enterprise applications (WAR/EAR files need containers) Hope this is clear. Regards, Naresh
Am trying to explain in detail...., 'war' files contains jsp, servlets, html etc., not the ejb files. This 'war' can run in any web server like Tomcat. But 'ear' files contains 'war' files as well ejb files. This will run in any Application server like JBoss,Weblogic. And 'jar' files is basically used for only standalone applications.
Creating war & ear files ------------------------
(1) sample folder may contains java,jsp,servlets,html,jpeg etc., is converted into war file by this command.
C:\Tomcat4.1\webapps\sample>jar -cvf sample.war *
(2) sample folder may contains sample.war and ejbs with may also contains html,jpeg etc., is converted into ear file by this
C:\Tomcat4.1\webapps\sample>jar -cvf sample.ear *
unzipping and extracting war & ear files ----------------------------------------
it will unzip and extracts all its content files from sample.ear file
Creating the jar files ----------------------
Creating a deployment file after you finish developing your enterprise bean, you need to package all the class files into one .jar file. For suppose, the ejb directory contains three files: Adder.class, AdderHome.class, and AdderBean.class. The
'METAINF' directory contains one file: the ejb-jar.xml file, the deployment descriptor.
Follow these steps to create the deployment file:
1. Change directory to the parent directory of both com and META-INF. 2. Assuming jar.exe is already in the path, type the following:
jar cfv adder.jar com/brainysoftware/ejb/* META-INF/ejb-jar.xml
3. This creates a jar file called adder.jar.
Sachin Ramesh Vir
Joined: Sep 15, 2005
Hi Madhav Penubala ,
Thank you very much for your reply. It's very clear explanation. Thanks a lot!!!