These files are simply zipped files using java jar tool. These files are created for different purposes. Here is the description of these files:
.jar files: These files are with the .jar extension. The .jar files contain the libraries, resources and accessories files like property files.
.ear files: The .ear file contains the EJB modules of the applications.