Protect class files from decompilation

Discussion in 'Java' started by Dave, Jan 9, 2007.

  1. Dave

    Dave Guest

    I understand that it is relatively easy to decompile Java class files into
    source code.

    How can I protect my application from being decompiled?
     
    Dave, Jan 9, 2007
    #1
    1. Advertisements

  2. Dave

    Alex Hunsley Guest

    You can't. What you can do, however, is use an obfuscator (e.g. ProGuard
    - google for "java obfuscator" for more) which makes the resulting
    decompiled code harder to understand/reuse/ripoff. Obfuscation usually
    reduces the compiled bytecode size too.

    All
     
    Alex Hunsley, Jan 10, 2007
    #2
    1. Advertisements

  3. Dave

    Alex Hunsley Guest

    Forgot to add - one 'defence' is to not give them your class files at
    all, but present your code as a web application (e.g. using Tomcat +
    servlets). May not be practical though.
     
    Alex Hunsley, Jan 10, 2007
    #3
  4. Dave

    xmx Guest

    Maybe you can encrypt your class file and implement your own classloader
     
    xmx, Jan 10, 2007
    #4
  5. Dave

    Dave Guest

    Sounds good, thanks.
     
    Dave, Jan 10, 2007
    #5
  6. And as the custom classloader has to be be shipped with the encrypted
    class...
     
    Laurent D.A.M. MENTEN, Jan 10, 2007
    #6
  7. Or better yet, write code that you don't need to
    feel ashamed of to show. ;-)

    scnr.
     
    Andreas Leitgeb, Jan 10, 2007
    #7
  8. Dave

    Lew Guest

    Or write code that performs so awfully that no one would want to decompile it.

    Seems stupid, but I've seen an awful lot of code in production that seems to
    follow that philosophy.

    - Lew
     
    Lew, Jan 11, 2007
    #8
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.