I've heard that they are the same, but I would like to know if the compression is always the same. Can I always rename .zip files to .war, and vice-versa?
If you mean this, then, according to the wiki page, the .war format is the same as the .jar format. .jar files are just .zip files which contain compiled java code, meant to be used as a library or executable. So the answer would be no, there is no technical difference; but .jar files should only be used for what they're intended for, not as general-purpose archives.
If you mean this, then there is a slight difference: this .war format is a gzipped-tar (.tar.gz) file, again meant to hold specific data (web pages). Gzip and Zip both use the same compression algorithm; however:
In both cases, you should only use the .war extension for the specific purpose it's intended for.
ZIP files can contain any kind of file and folder structure.
WAR files (Java Web Application Archives) are based on ZIP, but have a defined folder structure and requirements to some of the files in there (e.g., some stuff needs to be in a
So yes, you can rename a .war file to .zip to view its contents or unzip it using a tool that doesn't know about this relationship between the file format. But not just any .zip file will make a working web application — you'll have to be careful in creating the file and folder structure you're bundling up.