I have a jar file with a resources folder, and I have converted it to EXE using Launch4J.

How can I protect my resources from being extracted using winzip/winrar ?

  • 6
    You don't. You can add some trivial obfuscations to discourage script kiddies, but you aren't going to stop anyone determined.
    – Antimony
    Commented Jul 31, 2013 at 2:24
  • but obfuscations will not modify anything in the resources.Right now one can just right click and extract all the resources. I just to want to prevent that.
    – geek_guy
    Commented Jul 31, 2013 at 20:16

3 Answers 3


The only real protection is to not deliver the resources!

As long as you give the resources out of your hand they can be extracted. It may be difficult but it is possible to extract them.

The most secure way would be to store the resources on a server and access them in a remote way. But also then if the resource is on the client computer it is possible to extract them from memory.


The only real option you have here is to store the resources as encrypted data and decrypt them prior to loading in java. You could store the encrypted data as a byte array, and use some kind of xor encryption.

This is NOT secure, and you should NOT store any important keys, passwords, or credentials in any resource files.


I know few ways to prevent resources extraction/reading:

  1. Encrypt your resources and dynamically decrypt them in runtime without writing temp files.

  2. Load the resources from the Internet (require Internet connection).

  3. Corrupt the CRC32 of the resources files, this will make WinZip or WinRAR unable to extract your resources.

  4. Set \u0000 (\x0) as a file name prefix. The NUL terminator will make WinZip or WinRAR unable to extract files (and also read file names).

However, none of these increases security. Resources will be able to get decrypted or extracted, these are only "simple tricks" to prevent standard reading / extraction. But people with enough knowledge will be able to bypass them and fix the files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.