-3

Hi I have to create a jar which will be send to our client.But issue is client can decompile the jar and do changes according to his requirement. I want to create the jar such that client can't read the code and can't do any changes in it. Can any body tell me the best solution for this

agarwal_achhnera
  • 2,582
  • 9
  • 55
  • 84
  • 2
    **No chance!** You can obfuscate the code to make it more difficult. But the code will always be readable because the target *computer* has to read and interpret the code. Therefore the code is there and must be interpretable, even for a human. – Uwe Plonus Apr 22 '15 at 07:22
  • see http://www.excelsior-usa.com/articles/java-obfuscators.html – sodik Apr 22 '15 at 07:23
  • It's very unlikely that the client would decompile your jar and do changes. If so, you can always threaten legal action. – Kayaman Apr 22 '15 at 07:23
  • Security by obscurity has never worked; why do you want to do that anyway? – fge Apr 22 '15 at 07:25
  • Does these obfuscator allow to obfuscate selective classes in the jar – agarwal_achhnera Apr 22 '15 at 07:33

1 Answers1

2

You can't really deny the client any access to the code, otherwise he won't be able to execute it. Java bytecode can be decompiled.

The best you can do is to obfuscate it (rename all variables, classes and methods to a, b, c etc.) so it will be harder to understand what your code does and reuse it in other projects. I had rather positive experience with ProGuard which does this automatically on compiled classes.

Dmitry Grigoryev
  • 3,156
  • 1
  • 25
  • 53