Archive Files

  • Java Archive file(JAR)
    • JAR is an acronym of Java archive
    • JAR is a compressed format of a compiled Java project.
    • Contains .class files And some metadata And some other resources.
    • Used to distribute Java code/libraries for use by other projects.
    • To create a jar file Using eclipse go to project right Click on the project And select export.
    • To execute jar from terminal use
      • java -jar filename.jar
    • When we decompress a jar file We get our package and class file along with a folder Meta-INF which has a MANIFEST.MF
      • The manifest file describes the Java file.
    • Create jar from console
      • jar -cf test.jar package-name
    • View Data in Jar
      • jar -tf test.jar
    • Add new package in jar
      • Jar -uf test.jar new-package
  • WAR file
    • War file Is An abbreviation of web archive.
    • War is used to deploy web applications on different servers.
    • WAR bundles, HTML, pages, servlets, JSP, and web.xml And other files related to web development.
    • WAR helps us to easily deliver and deploy projects.
    • A WAR file represents one web application.
    • web.xml Contains the web metadata info of the WAR file.
  • EAR files
    • EAR files are an Abbreviation of Enterprise Archive Files.
    • Represents Enterprise application.
    • Contains anything from Java J2EE for example EJB, JMS,Servlets, JSP’s, EJB’s, JMS et cetera.
    • In many cases, EAR contains both WAR and JAR files.
    • It contains a descriptor called as manifest.
    • app.xml contains the metadata info of the EAR file.

No comments:

Post a Comment