Jar and war file




















They are packaged as a. WAR files are used for web applications. They are deployed to a JSP engine or to a servlet. It is most commonly used to package Java classes, but a lot of other things can be packaged as well. However, WAR files are specifically for web applications.

WAR files can be made manually as well. WAR files are located in the web apps directory. WAR files may store different resources in different applications, which might create a hassle. To use files located in WAR files the user is required to unzip the folder. JAR and WAR files are two different file formats, they can be created manually but from different formats. See wiki. Nice illustration! Both of them are types of archive files but their accessibility is different.

JAR is a file format, an acronym used for java archive files, it is used to accumulate several java class files and associate metadata and resources in one file for distribution. In simple terms, it is used for compressing files just like one can do in a ZIP folder. It can be used as a general archive tool in devices.

Generally, the JAR file contains number directory, audios, images, etc. JAR files can be made manually as well. Objects in files are python classes that wrap file descriptors to make working with files more convenient and less error-prone. JAR files are the only cross-platform archive format. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Difference between jar and war in Java Ask Question. Asked 10 years, 8 months ago. Active 3 months ago. Viewed k times.

Improve this question. Add a comment. Active Oldest Votes. From Java Tips: Difference between ear jar and war files : These files are simply zipped files using the java jar tool. Improve this answer. Dada 5, 4 4 gold badges 20 20 silver badges 37 37 bronze badges. Am having an doubt as the jsp and additional web application files why cant be in jar file.

R They can - a jar file is just a zip file. If it will do anything useful is another matter, which depends on the code you want to utilize the jar file.

As an interesting example the Jenkins Continuous Integration server is distributed as a WAR file, which can be run with "java -jar". See wiki. Joby Wilson Mathews Joby Wilson Mathews 8, 4 4 gold badges 47 47 silver badges 45 45 bronze badges. Nice illustration! Crowder T. Crowder k gold badges silver badges bronze badges. A WAR usually contains other resources besides web components, including: Server-side utility classes database beans, shopping carts, and so on.

Community Bot 1 1 1 silver badge. So does this mean if you're building a server app that just uses sockets and doesn't have any UI there is no need to package it as a war file? Actually now I'm reading a bit more I don't need Tomcat, I can just export the jar to the server and run it directly from there.

Justin Niessner Justin Niessner k 38 38 gold badges silver badges bronze badges. The second statement is not necessarily true. A jar can also start an embedded web server, e. A jar can also just be a library of code to be used by other applications.



0コメント

  • 1000 / 1000