1.

What is a WAR file in Java?

Answer»

WAR stands for Web Application RESOURCE or Web Application Archive. It finds its application in distribution of a collection of JAR(Java Archive) FILES, Java Server Pages, Java Servlets, Java Classes, XML files, tag libraries, static web pages, and other resources that constitute a web Application.

WAR files have the file extension .war. These are extended from JAR files.

So, a .war is a .jar, but it contains web application components and is laid out according to a specific structure. A .war is designed to be deployed to a web application server such as Tomcat or Jetty or a Java EE server such as JBoss or Glassfish.

The primary advantage of a .war file is it combines all files into a single unit which reduces the transfer time from client to server.

To create a war file, we need to use the jar tool of the Java Development Kit. Go inside the project directory of your project, then write the following command:

jar -cvf yourproject.war *

The -c switch is used to create file, -v is used to generate the verbose output and -f switch is used to specify the archive name of the file.

During Java runtime, verbose OPTIONS can be used to tell the JVM which kind of information to see. JVM supports three verbose options out of the box. As the name suggests, verbose is for DISPLAYING the work done by JVM.



Discussion

No Comment Found