It's not clear what your goal is here. A "jar file" is a format that, by design, anyone can extract from. If you change the file so it's no longer extractable, it's not really a jar file any more.
What's in the jar file? If you're using it for storing something other than .class files, then there are various ways you can encrypt the contents of a file. However if you're talking about the most common situation in which the jar file contains .class files which must be accessible and understandable by a JVM, then fundamentally it's not going to be possible to prevent people from accessing the original .class file. Evn if you bury it under one or more layers of encrytion and decryption - the JVM still needs to be able to receive an unecrypted version, or the class won't load. And it's always possible for someone to hack a JVM (source code for some versions is freely available) to copy the unencrypted version to a file. See
this article for details.