Asheesh_Kumar
asked on
Contents of WAR , JAR and EAR files
whar are Contents of WAR , JAR and EAR files>
difference between these?
difference between these?
ASKER
can Jar file contains JSP or Servlet or XML or Image file or all...?
can WAR file contains EJB component?
can WAR file contains EJB component?
They can contain them, but application servers (which are the things that JSPs/servlets run on) do not "deploy" jar files, only EAR and WAR. So really they all can contain anything, but a JVM/command line will not handle or do anything with web components. War files are the same way as far as they can contain anything, but you cannot "run a war file" from the command line, only deploy it on an app server. Does this make sence?
So basically....
JAR = java class file
WAR = JSP + JAR - (internet apps - webservers that run JSPs/Servlets)
EAR = J2EE/EJB/Eetc. + WAR - (enterpise apps - java application servers)
JAR = java class file
WAR = JSP + JAR - (internet apps - webservers that run JSPs/Servlets)
EAR = J2EE/EJB/Eetc. + WAR - (enterpise apps - java application servers)
And basically....
JARs run on JVMs, whereas WARs and EARs run on application servers. Applications server use JVMs to run the various java programs in WAR/EAR/JAR files. The application server also uses the other components of the WAR/EAR file for configuration and prosessing, such as interpreting the servlet/HTML code and other webserver/cgi tasks.
JARs run on JVMs, whereas WARs and EARs run on application servers. Applications server use JVMs to run the various java programs in WAR/EAR/JAR files. The application server also uses the other components of the WAR/EAR file for configuration and prosessing, such as interpreting the servlet/HTML code and other webserver/cgi tasks.
ASKER
do you want to say we can put jsp or even ejb on JAR file.. but it won't work....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
excellent...
Thanks for the points and the question. Cheers.
Jar (Java ARchive) files are basically what a java application uses and contain the class files which have the libraries/compiled code, properties files and any other resources for the app, such as classpath entry to specify other classes to load. An app can be run by the command line.
EX: java -jar <jarfilename>.jar
War files (Web Applications aRchive) are "web apps" that are deployed on a server that implements JSP containers/servlets. The have jsp, XML, html, and any other resources for the web server. They are typically loaded/deployed through the "management console" of the java application server, such as webshpere, apache, etc.
Ear files (Enterprise ARchives) are JAR, WAR and EJBs combined. They are also deployed through the server console.
There are also RAR files (Resource Adapter aRchive) files whare are used in the JCA (J233 Connection Architecture). These are Java archives which also store Classes, XML files, and other objects. NOTE: this has no relation to the RAR compression format