• 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

War with WAR, EAR and JAR

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
winzip can expand them jar/ear/war

you create a war the same way you create a jar....exactly the same way....actually you can make it a jar, then rename to war

within the ear, you can find wars and jars....

make love not war....
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sachin,

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

command.

C:\Tomcat4.1\webapps\sample>jar -cvf sample.ear *



unzipping and extracting war & ear files
----------------------------------------

(1) C:\Tomcat4.1\webapps\sample1>jar -xvf sample.war.

it will unzip and extracts all its content files from sample.war file


(2) C:\Tomcat4.1\webapps\sample1>jar -xvf sample.ear.

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
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Madhav Penubala ,

Thank you very much for your reply. It's very clear explanation. Thanks a lot!!!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic