atool is designed for this job. A copy of the man page is available here.
To compress files use
apack ARCHIVE FILE
and to decompress them use
(alternatively you can use
atool -a and
atool -x respectively).
It works with pretty much any archive format you can think of including gzip, bzip, lzip, 7z, rar, ar, deb, rpm, jar and most combinations of tar and a compression method.
The advantage of this over 7zip is that 7zip removes executable permissions. So, for example, 7zip makes it much more difficult to install software from archived sources because you need to manually
chmod +x the appropriate files before running any make or any install scripts.
 The online man page linked is for an older version that doesn't handle jar files.