Difference between .jar, .war and .ear file

Hi,
I am pretty new to J2EE technology.
I would like to know what is the difference between .jar, .war and .ear files and how they are deployed on webserver.
Thanks,

Files with a .jar extension or JAR files, are essentially just a collection of files compressed using the ZIP/ZLIB compression format.
JAR (short for Java Archive) files were introduced in the early days of Java as a means to conveniently package and distribute Java applications and components. Since then, a number of additions to the Java platform have followed suit. The introduction of the EAR file is one such addition.
An EAR (Enterprise Archive) file is a JAR file that contains a J2EE application.
A J2EE application is a group of Web modules that collectively perform as a single entity.
A Web Module is an entity consisting of one or more resources such as HTML files, Java class files, XML files, etc. Web Modules are packaged in Web Archive (WAR) files.
Looking at it from a top-down view, EAR files contain JAR files and WAR files. Packaging resources in WAR files, JAR files and eventually EAR files, makes it easy to reuse and reassemble components as new J2EE applications and distribute them to new environments.
For example, Tomcat deals only with WAR files.
So, in order to auto-deploy a Web application to a Tomcat environment, you must place an application's WAR file in the appropriate directory or use Tomcat's deployment tools to manually deploy the file.
If you already have an EAR file that contains the WAR file, you can extract the WAR file and use it as is. If you do not have the EAR file or the WAR file, you can use any number of compliant tools to create the WAR file. Tomcat is a servlet/JSP container available from the jakarta.apache.org site.

Similar Messages

  • Jar, War or Ear file ?

    Hi,
    I am a total newbie in J2EE technology.
    I am currently using Sun One Application. Using the sample application, it produces all the Jar, War and Ear files.
    My understanding is Jar is produced to be a library-like usage.
    War is for web application.
    And Ear is for what?? oops EJB? Can someone tell me?
    Anyway, my concern is, if I am to produce Ear, war, or Jar file after deploy, I have problems doing the testing. Let's say I want to modify the Jsp file, then I have to use ant to compile all, undeploy the instance and deploy again.
    Any better way?

    your jar files contain your EJBs, your WAR file contains your web application (JSPs, servlets and support) and these are all bundled into your EAR file. All of these files are just zip-formatted archives, you can look at them all via the jar tool (or something like WinZip, if you are so inclined). Each of these will contain a descriptor file (in XML format) - check out the J2EE spec on it.
    Lee

  • What is the difference between Topic Keywords and Index File Keywords?

    What is the difference between Topic Keywords and Index File Keywords? Any advantages to using one over the other? Do they appear differently in the generated index?
    RH9.0.2.271
    I'm using Webhelp

    Hi there
    When you create a RoboHelp project you end up with many different ancillary files that are used to store different bits of information. Many of these files bear the name you assigned to the project at the time you created it. The index file has the project name and it ends with a .HHK file extension. (HHK meaning HTML Help Keywords)
    Generally, unless you change RoboHelp's settings, you add keywords to this file and associate topics to the keywords via the Index pod. At the time you compile a CHM or generate other types of output, the file is consulted and the index is built.
    As I said earlier, the default is to add keywords to the Index file until you configure RoboHelp to add the keywords to the topics themselves. Once you change this, any keyword added will become a META tag in the topic code. If your keyword is BOFFO, the META tag would look like this:
    <meta name="MS-HKWD" content="BOFFO" />
    When the help is compiled or generated, the Index (.HHK) file is consulted as normal, but any topics containing keywords added in this manner are also added to the Index you end up with. From the appearance perspective, the end user woudn't know the difference or be able to tell. Heck, if all you ever did was interact with the Index pod, you, as an author wouldn't know either. Well, other than the fact that the icons appear differently.
    Operationally, keywords added to the topics themselves may hold an advantage in that if you were to import these topics into other projects, the Index keywords would already be present.
    Hopefully this helps... Rick

  • Differences between .profile,oraenv and dbhome files

    can anyone tell me the differences between .profile,oraenv and dbhome.
    database version is 10.2.0 and OS is solaris 10.
    I have set up the environment variables using .profile
    is the functionality of oraenva and dbhome same like .profile?

    Hello,
    oraenv and oracle home_
    The oraenv and coraenv utilities both aid in setting the Oracle environment on UNIX systems (other utilities exist on Windows platform that enable the Oracle Home to be set.) The coraenv utility is appropriate for the UNIX C Shell; oraenv should be used with either the Bourne or Korn shells.
    Database operations require the ORACLE_HOME to be set before the user may access the database. If ORACLE_HOME is not set, commands such as sqlplus, exp, or any other utility for that matter, will not be found.
    Both utilities are shell scripts that do the same thing in the different UNIX shells. They will prompt for a SID of the database unless ORAENV_ASK is set to N. The utility will also append the ORACLE_HOME value to the path, marking the location of the utility.
    The oraenv command will prompt for the SID of the database that you wish $ORACLE_HOME to access.
    $ . oraenv
    ORACLE_SID = [] ? ASG920
    The dbhome utility can now be used to verify that $ORACLE_HOME is correct.
    $ dbhome
    /usr/oracle/9.2.0
    The “dot space” part of the command is required to make the environment change with the parent shell, as opposed to entering a command without it which would only affect the subshell running that process.
    These commands can be used to avoid specifying the network service name when issuing commands. For instance, without using oraenv, a sqlplus command would look like:
    $ sqlplus system/manager@nameofservice as sysdba
    whereas after oraenv has been executed, the following command would work:
    $ sqlplus system/manager as sysdb
    The profile:_*
    The Profile file in your home directory is a collection of Korn shell commands that are executed whenever you login. Commonly, the Profile file is used to set environment variables and shell options. You can also put command aliases in your Profile file, but it's better to put them in a separate file -- commonly called .env (which is pronounced: dot-e-n-v)-- that you define and execute in your Profile (which is pronounced: dot-profile).
    This document briefly introduces environment variables, shell options, and aliases, and gives sample Profile and .env files.
    The commands in this document assume that you're using Korn shell, which is the default login shell on all the ACCC UNIX machines. Shell variables (like $PRINTER and $ENV, which are introduced below) are defined slightly differently in C shell. For example, to select the U-Print system as your default printer in csh you'd use the printer named uprint:
    PRINTER uprint
    setenv PRINTER

  • Difference between capture rendering and video file rendering

    Hello,
    I am using JMF to process a video coming from a camera or from a video file, but I noticed some differences in the screen output between these two cases.
    I created a Processor and attached an Effect plug-in to its codec chain. On every frame, some processing is done in the process() method of the Effect. Every automatic update of the processor's visual component fires automatic update of my transparent custom drawing pane positioned on top of it (because they overlap). This way I can easily draw some lines over the video layer.
    This works fine on capture. When the video comes from a file, however, the JMF visual component always shows the previous frame (not the one just processed), so my drawings are out of sync (they are a step ahead from the frame displayed).
    Why is that? The processing code is the same for the capture and the files, only the dataSource is created differently.
    Thanks in advance!

    b.o.j.o. wrote:
    How could I fix this problem?Render the frames yourself.

  • How to Create a jar war or ear--Probelms in deploying

    I have the following dir structure. I am using Struts 1.1 and weblogic 7.0
    APP
    +jsp
    +WEB-INF
    + ---lib
    +--- classes
    +----com
    --ap
    --action
    --beans
    --handler
    --service
    --client
    --ejb
    --valueobject
    1> Do I need to create a ear file since i want both the ejb (under service folder) and war as reusable components. Whenever we have a EJB component do we always need to have an EAR file??
    2> Whats the best way to create the jar, war or ear file. I am facing great difficulty in deploying the war.Do we need to set any classpath before we create the war and jar files except for the deployment descriptors.I have created the ejb descriptors correctly through ejbc.
    3>I have kept struts.jar,log4j.jar under lib folder. However when i create the ear and try to deploy it under weblogic it deploys the war file but gives error in deploying the jar which has the ejb. I have aslo validated the jar using ejbc.
    It gives error indicating that it requires struts.jar in classpath. If we give the classpath of struts.jar at system leve the Application deploys with ease..Can anyone tell whats the error.The jar does not use any strust component .
    4>Also the valueobject which has some beans which are used to populate the jsp through Actionformbean. Is it ok if we give refrences in both ejb jar and war?
    ie while creating jar and war folder have the valueobject in both the files or will it lead to any errors..
    Thanks in Advance
    ....

    Yes, I have tried that. But, as the server is running and the jars are in use, it throws and EditFailedException

  • What's differences between camera roll and photostream?

    what's differences between camera roll and photostream files?

    Camera Roll is all photos & videos taken directly with the device, including screenshots, and also any images saved from a text message, email or website.
    Photostream is a service that, after you've taken such a photo, after you close out the Camera app (or switch to a different app or your home screen), uploads a copy of that photo via wi-fi to your iCloud Photostream account. 
    Camera Roll photos are saved until you delete them.
    Photostream photos will remain in Photostream for 30 days minimum.  After that, they will be automatically purged from the system.  If there are photos in your Photostream that you would like to save permanently, copy them to your iPhone's Camera Roll, or download them to your computer using the iCloud Control Panel.

  • Difference between .war file and .ear file

    Hi,
    what is the difference between .war file and .ear file ?
    Please let me know with appropriate explanation.

    War file means web application archive. It is archived file having a collection of JSP, servlets and static pages that together costitute a web application. It contains one WEB-INF directory which will have a file named web.xml which defines the structure of the web application.
    On the other side EAR file is Enterprise application archive. It is file having packaged content of one or more modules into a single archive so that the deployment of all the modules can be done simultaneously on the application server. It also contains XML files called deployment descriptors which gives the details of the deployment method. This deployment descriptor will be present in the folder META-INF folder.
    So the main difference betwwen the two is that Ear file is having collection of various modules to be deployed on the application server while the WAR file is used to deploy the web applications.

  • Difference between jar file and package?

    What is difference between a package and jar?
    Is a jar a package? or is package jar?
    If I say
    package pink;
    does it mean pink is folder or jar?
    what if I say import pink.rose;
    does it import jar file with the rose class inside it?

    These two concepts are unrelated. A jar file is nothing more than a zip file of class files and other related resources, which you can use to 'bundle' your application for ease of deployment. Th use of zip files is not mandatory.
    Packages on the other hand, are a means of 'packaging' parts of an application or library in their own namespace, generally for reasons program structure, and to avoid naming collisions. A bunch of classes in a package will be compiled into a bunch of class files, on a one-to-onwe basis (one file per class).
    You may chose to 'bundle' those and other classes into a jar file.

  • I have a created a directory structure ias\ias-samples\myapps\src\docroot.In docroot folder i have a single jsp.i created a war file having that jsp,and ear file having the war file

    I deployed the ear file.Now i try calling http://localhost/myapps/test.jsp ??
    i'm i doing the right thing ?

    Hi,
    This is right provided you have installed the webserver & app server
    on the same machine and the port number for the web server is 80 by
    default.
    Regards
    Raj
    Arif Khan wrote:
    I have a created a directory structure
    ias\ias-samples\myapps\src\docroot.In docroot folder i have a single
    jsp.i created a war file having that jsp,and ear file having the war
    file
    I deployed the ear file.Now i try calling
    http://localhost/myapps/test.jsp ??
    i'm i doing the right thing ?
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • What is the difference between undo tablespace and online redo log files.

    what is the difference between undo tablespace and online redo log files. I am confused
    as per my knowledge undo tablespace is used to store the undo information when a table is being updated so that, just incase we need to rollback a transaction we know what was present in the table earlier.
    when a transaction fails the SMON performs the rollback of the data.
    This undo data is stored in the undo tablespace and read consistency if any is enforced.
    is my understanding till here correct?
    Now, can this undo data/before image not be stored in the redo log buffer and online redolog files?
    can redo-log files not store this information?
    in fact, is it that when undo tablespaces exist in a database, the undo data/before image is stored in both the undo tablespace and also the redo log files?
    kindly clarify my doubt.
    thank you.

    This question has been asked many times before. The answer is always the same.
    Yes, redo contains the before image of data (and the after-image). Therefore, it **COULD** be used to roll back a transaction.
    BUT... Redo is written sequentially. Using it to rollback your transaction would involve reading through all the redo written by maybe thousands of other people. It would be painfully slow.
    Your transaction is, however, directly linked to just the UNDO that it generates (which is JUST the before image of the data). So, your undo is your undo and doesn't share space with anyone else's undo. Therefore, using it to roll back YOUR transaction is fast.
    The fact that undo is only the before image of the data also makes it faster than wading through a sea of before and AFTER images as you'd find in redo. About twice as fast, in fact, since there's half the data. Roughly.
    Redo also gets written and flushed to disk whenever there's a commit, 3 seconds are up or too much (1MB, actually) redo gets generated between flushes caused by other factors. Your redo gets flushed when those things happen, even if you haven't actually committed your transaction. And redo logs recycle themselves, meaning that your redo -even if your transaction hasn't been committed yet- can be over-written by later transactions. Try rolling back when that's happened, if redo was the source of your rollback data!
    Undo, however, cannot be over-written if the transaction has not been committed. Ever. If you don't commit for three years, there will be three years' undo stored in your database (assuming you had the space, of course!).
    I could go on, but that will do. Redo is there fore RECOVERY, after catastrophe. Undo is there for read-consistency (and the occasional change of mind). Two different functions. Two different mechanisms. Each one highly tuned to doing what it does, why it does it, most efficiently and effectively.

  • What is the difference between httpd.pid and httpd.lock files?

    What is the difference between httpd.pid and httpd.lock files?

    Hi;
    Apache httpd saves the process id of the parent httpd process to the file logs/httpd.pid .
    LockFile
    Sets the path to the lockfile used when Oracle HTTP Server is compiled with either USE_FCNTL_SERIALIZED_ACCEPT or USE_FLOCK_SERIALIZED_ACCEPT. It is recommended that default value be used. The main reason for changing it is if the logs directory is NFS mounted, since the lockfile must be stored on a local disk.
    For example: LockFile /oracle/Apache/Apache/logs/httpd.lock"
    Please see:
    http://download.oracle.com/docs/cd/B14099_19/web.1012/b14007/fileloc.htm#sthref254
    Regard
    Helios

  • Difference between  MDM adaptor and File adaptor?

    Hello All,
    Could any one light on the difference between PI Adaptor and File adaptor?
    Thanks
    Rajeev

    Hi,
    >>>Could any one light on the difference between PI Adaptor and File adaptor?
    for MDM <= 5.5
    there was no difference as file adapter was the MDM adapter
    it changed with the latest version as Shabz mentioned
    Regards,
    Michal Krawczyk

  • Difference between applicationdir/lib and domaindir/lib/ext

    Hello,
    In my application I use scriptura (A document generation product). The jar containing this products code uses the JAXP API.
    If I include the jar in my ear file there is no problem.
    If I don't put the jar in my ear file but put it in the lib/ext directory of my domain (i.e. c:\sun\applicationserver\domains\domain1\lib\ext) then the application throws a NoClassDefFoundError (org/apache/xml/serialize/XMLSerializer)
    However If I put the jar in the lib directory of my application directory (i.e. c:\sun\applicationserver\lib) then everything works fine again.
    I have read some of the documentation and if I understand it correctly third party jars should be in the lib/ext directory. Therefore I would like to see it work with scriptura jar in the lib/ext directory.
    I have also looked up some information on classloaders but the way I understand the documentation both directory will be loaded by the common classloader (which is situated between the bootclasspath and the application classloader)?
    Can you explain me the difference between putting a jar in the lib of the application directory or putting it in the lib/ext directory of the domain.
    Thanks in advance,
    Kind Regards,
    Niels

    domain_dir/lib/ext is an extension directory used by the Java Optional Package Mechanism. Any libraries placed in this directory are loaded just after the core JDK classes and before any application server or application libraries. Hence, the libraries placed in this directory should not refer to any classes in application server or application libraries.
    In this particular case, scriptura depends on the JAXP API which is not part of the core JDK Classes. Hence, a NoClassDefFoundError is thrown.
    However, when scriptura is placed in the appserver\lib directory, the required JAXP classes are also loaded by the same classloader and scriptura finds the required classes.
    Bottom line, if a class is loaded by a classloader, then all the classes referred to by this class (directly or indirectly) must either be loaded by this classloader or its parent classloaders.

  • Difference between wait event and timed event

    Hi,
    Anyone has idea that what is the difference between wait events and timed events in Statspack report. I couldn't find it over google.
    Thanks.

    It's 10.2.0.1 on Linux
    (Couldn't do a query, because Linux is inside VM Ware. And it is not being accessed from Base windows machine.)
    Top 5 Timed Events                                                    Avg %Total
    ~~~~~~~~~~~~~~~~~~ wait Call
    Event Waits Time (s) (ms) Time
    db file scattered read 9,750,617 34,611 4 44.7
    CPU time 14,248 18.4
    read by other session 1,532,282 8,984 6 11.6
    db file sequential read 4,514,494 5,588 1 7.2
    latch: cache buffers lru chain 277,245 4,823 17 6.2
    Wait Events  DB/Inst: ABCD/ABCD  Snaps: 1-2
    -> s - second, cs - centisecond, ms - millisecond, us - microsecond
    -> %Timeouts: value of 0 indicates value was < .5%. Value of null is truly 0
    -> Only events with Total Wait Time (s) >= .001 are shown
    -> ordered by Total Wait Time desc, Waits desc (idle events last)
    Avg
    %Time Total Wait wait Waits
    Event Waits -outs Time (s) (ms) /txn
    db file scattered read 9,750,617 0 34,611 4 24.2
    read by other session 1,532,282 0 8,984 6 3.8
    db file sequential read 4,514,494 0 5,588 1 11.2
    latch: cache buffers lru chain 277,245 0 4,823 17 0.7
    latch free 121,466 0 3,291 27 0.3
    ----------------------------------------------------------------------------------------------------

Maybe you are looking for