The difference between a jar package and a war package in Java is

Source: Internet
Author: User
Tags tomcat server

In fact, both the jar package and the war package can be regarded as compressed files, can be opened with decompression software, jar packages and war packages exist because, for the deployment and release of the project, usually the project packaging, usually in the packaging of the deployment, will be included in the deployment of relevant information.

This package actually compresses the code and dependencies into a file with the suffix. jar and. War, which is what we call the jar package and the war package. However, this "compress package" can be used directly by the compiler, put the war package under the WebApp of the Tomcat directory, and the Tomcat server can use the war package directly when it is started. The usual tomcat practice is to unzip, compile the code inside, so when the file is a lot, Tomcat will start very slowly. With so much to say, there is no difference between a jar package and a war package. The jar package is a Java package, the war package can be understood as Javaweb hit the package, this will be more good to remember.

The jar package is only packaged in Java-written items, with only the compiled class and some deployment files. The war package contains everything, including written code compiled into the class file, dependent packages, configuration files, all Web pages, including html,jsp and so on.

A war package can be understood as a Web project, which is everything in the project. When do I use a jar package or war package? When your project is not fully completed, it is not appropriate to use the war file, because your class will often change because of debugging, such as to delete, create a war file is not convenient, back and forth to modify, packaging, it is best that your project has been completed, do not modify the time, then make a war bag it, At this point a war file is equivalent to a Web application, and a jar file encapsulates a class and some related resources into a package for easy reference in the program.

The difference between a jar package and a war package in Java is

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.