File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Protection of .class file from decompilation. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Protection of .class file from decompilation." Watch "Protection of .class file from decompilation." New topic

Protection of .class file from decompilation.

Serghei Jelauc
Ranch Hand

Joined: Jul 24, 2002
Posts: 128
Hi javers.
I need to protect my .class file from decompilation. Could you say me how I can do it?
Thanks in advance.

SCJP 1.4 <br />SCBCD 1.3<br />SCWCD 1.4
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Try using Google to search for "java obfuscation".
You should be able to find something to help you.

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Dermot Curley
Ranch Hand

Joined: Jul 03, 2002
Posts: 43
Another option is to encrypt the class file and then decrypt it "on the fly" by modifying classLoader. This tutorial got me up to speed on classloader pretty quick. (You will have to register for the pleasure).
It is worth saying that this will not work the same for an applet, security restrictions will prevent you from messing with classLoader, but it should work fine for an application.
[ February 24, 2003: Message edited by: Dermot Curley ]
[ February 24, 2003: Message edited by: Dermot Curley ]
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46367
Raj Bansilal Champaneriya,
Your post was moved to a new topic.
I agree. Here's the link:
subject: Protection of .class file from decompilation.
It's not a secret anymore!