title: How do I use ProGuard?
body: <p>I was trying to learn how to use <a href="http://proguard.sourceforge.net/" rel="noreferrer">ProGuard</a>, and it is no way as easy as I thought. At first I found a simple Java code to try it, a simple <a href="http://www.leepoint.net/notes-java/examples/components/calculator/calc.html" rel="noreferrer">two class Swing calculator</a>.</p>
  
  <p>The code can be found by following that link, but I found it too verbose to post the it here. Anyway, it is a plain application with entry point on <code>Calc.main()</code>, there are no packages.</p>
  
  <p>Then I compiled both sources with:</p>
  
  <pre><code>$ javac *.java
  </code></pre>
  
  <p>and created the <code>.jar</code> file (because it seems ProGuard only work with jars):</p>
  
  <pre><code>$ jar cvef Calc calc.jar *.class
  added manifest
  adding: Calc.class(in = 3869) (out= 2126)(deflated 45%)
  adding: Calc$ClearListener.class(in = 468) (out= 327)(deflated 30%)
  adding: CalcLogic.class(in = 1004) (out= 515)(deflated 48%)
  adding: Calc$NumListener.class(in = 1005) (out= 598)(deflated 40%)
  adding: Calc$OpListener.class(in = 1788) (out= 1005)(deflated 43%)
  </code></pre>
  
  <p>Wrote the ProGuard file named <code>obfuscate.pro</code>:</p>
  
  <pre><code>-injars       calc.jar
  -outjars      calc_obf.jar
  -libraryjars  &lt;java.home&gt;/lib/rt.jar
  
  -keep public class Calc extends javax.swing.JFrame {
  public static void main(java.lang.String[]);
  }
  </code></pre>
  
  <p>And finally run ProGuard:</p>
  
  <pre><code>$ ~/progs/proguard/proguard4.8/bin/proguard.sh @obfuscate.pro
  ProGuard, version 4.8
  Reading program jar [/home/lucas/tmp/calc.jar]
  Reading library jar [/usr/lib/jvm/java-7-openjdk-i386/jre/lib/rt.jar]
  Error: The output jar is empty. Did you specify the proper '-keep' options?
  </code></pre>
  
  <p>Well, obviously didn't work. I got tired of messing with ProGruard parameters, specially with that <code>-keep</code> options, with no success. All I found in the docs related to my problem could not help me. Then I am resorting to you... What is wrong? How to do it right?</p>