Geertjan's Blog

  • January 31, 2008


Geertjan Wielenga
Product Manager
Today I was asked about obfuscation. In fact, the question was "how to obfuscate code in NetBeans". Well, code in NetBeans is like any other Java code anywhere else. And others have had the same need. I looked into it and came up with the following:

  1. Download ProGuard.

  2. In your build.xml, add the target outlined in this handy FAQ: Can I obfuscate a module? Just make sure to replace ${proguard.jar.path} with the full path to the proguard.jar, which can be anywhere. Also remove the dependency on init target, in the obfuscate target outlined in the above FAQ.

  3. Build your application. When you do so, the Output window shows that ProGuard writes a new folder with your own module's obfuscated classes:

  4. Look in the folder indicated above and there's the 'obfuscated' folder with the obfuscated classes:

Next I tried to decompile the classes, but all 3 of the decompiler plugins in the Plugin Portal failed me. But, if one wanted to decompile, there are many decompilers out there that could be used. The point is that obfuscation is not difficult to achieve, via the handy Ant target above. And, it's clear that if you have some top secret code that you need to obfuscate, there's a well trodden path that you can follow.

Join the discussion

Comments ( 6 )
  • asantiago Thursday, January 31, 2008

    I used ProGuard, with JDK6 code, some time ago and all decompilers I used failed. It seems a problem about JDK6 bytecodes and the decompilers.

  • guest Friday, February 1, 2008

    surely that's a good thing?

  • Geertjan Friday, February 1, 2008

    You're a funny man, :-) Or maybe you're a woman. Woo... you obfuscated your gender. :-)

    As for me, and asantiago, we'd like to decompile our code so that we can see that we've obfuscated it correctly. But, you're right, if we're able to decompile it, then the obfuscation is less obfuscated than now that we've failed to do so.

  • Paris Apostolopoulos Friday, February 1, 2008

    Nice post Geertjan ..thanx!

  • Kevin Tarn Wednesday, October 29, 2008

    Is it possible to configure Proguard for a GWT based project?

  • dawit Thursday, May 6, 2010

    Is there a zelix(ZKM) maven plugin that you guys know of?

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha