I'm developing an application using java but I'm not going to release the code. The problem is, I tested one of these jar de-compilers and it was able to get the code from my jar file almost perfectly! My question is how can I distribute my jar file without my code being extracted from it?
As Java preserves most of the "metadata" during compilation (which allows dynamic loading and reflection), it is a straight forward to decompile (not only disassemble) the compiled class files. That's why the recovered code is very similar to the original.
While not perfect, your probably only option is to use an obfuscator, such as ProGuard.
You can't. At the minimum, the JVM is going to need to get the code out in order to run it. And if the JVM can get the code out, anyone can.
The best you can do is obfuscate the code, but I would recommend against it because it will make tracking down production bugs very difficult because the stack traces will be hard to follow.
There is no possibility to protect the code from disassembling. You can use obfuscation tool like 'proguard'. Even after decompilation it will be almost impossible to understand the code.
Obfuscate your code using some obfuscator in the market. Obfuscators change the names of your class and its methods to some weird looking names so that it becomes hard for people to make sense of the code. Mind it, people would still be able to decompile your code but only thing is it would be hard for them to understand it due to the jumbled names.
Downside of this is, it would be hard for you to debug and support the obfuscated code in case your customer faces some issues as the stack traces in the exceptions would have the jumbled up class and method names.
it's never impossible to reverse-engineer in java but i think that Proguard is the best. It is also possible to integrate it with your IDE (for example NetBeans). and ygard for ant
© 2022 - 2024 — McMap. All rights reserved.