-2

I want to reveal my desktop java application to public, but I'm not sure how to protect it from reverse-engineering or source code stealing?

Is it possible to convert the application to an exe file? and if it is, wouldn't that be enough to protect it?

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
mwdar
  • 141
  • 2
  • 3
  • 10
  • 4
    Determined people will always find a way to reverse engineer your code. – Jeffrey Aug 12 '11 at 19:57
  • 3
    *"I'm no't sure how to protect it"* Make it crappy (the default for people asking this question) and nobody will bother to reverse engineer it. – Andrew Thompson Aug 12 '11 at 20:31
  • 1
    Does this answer your question? [Best Java obfuscator?](https://stackoverflow.com/questions/2537568/best-java-obfuscator) – David Buck Jan 15 '23 at 06:58

3 Answers3

5

If it's really worth someone's time to reverse engineer your source from the binary, they will. You might be able to make it slightly harder, but never impossible.

Sam DeHaan
  • 10,246
  • 2
  • 40
  • 48
5

You can use a Java Obfuscator such as ProGuard.

ProGuard is a free Java class file shrinker, optimizer, obfuscator, and preverifier. It detects and removes unused classes, fields, methods, and attributes. It optimizes bytecode and removes unused instructions. It renames the remaining classes, fields, and methods using short meaningless names. Finally, it preverifies the processed code for Java 6 or for Java Micro Edition.

Marcelo
  • 11,218
  • 1
  • 37
  • 51
  • ProGuard makes things quite painful for would-be reverse-engineers. Imho, this is about as good as you can do. – nerdytenor Aug 13 '11 at 00:00
3

A Java executable and a native executable are both just a bunch of machine code (with optional annotations and stuff). So there's essentially no difference in terms of how easy it is to reverse-engineer.

If you are compiling with javac, you can use the -g:none flag to eliminate all debug info from being compiled into the executable.

Oliver Charlesworth
  • 267,707
  • 33
  • 569
  • 680