if there are many files and they are dependent in nature for your program. It is very tough to put them in classpath to access them run time.For solving this problem java has come up with archiving concept. It’s concept is simple. put all the classes in a zip file and make that available in classpath while running the java code.
Again consider one more example, if our program contains of many HTML files,images files etc. so to download one single file, it is required to download all the components of the file. And for that we require so many HTTP connections to get all those. It will take more time and patience. so zip file is a nice concept .
Mainly we have 3 types of zip file in java..
- jar (java archive file)
- war (web archive file)
- ear (enterprise archive file)
Let’s check out the difference between them: