1 Replies - 1999 Views - Last Post: 03 October 2012 - 11:54 PM Rate Topic: -----

#1 cassiopeia  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 86
  • Joined: 03-April 11

obfuscator proguard in netbeans

Posted 03 October 2012 - 03:58 AM

the is question is how :dozingoff: . i've read this article and article from wiki netbeans.

i already make some code base on the first article. i clean and recompile, and no explicit message telling me that obfuscating successfull, but no error too. so how do i know it work or not ? :helpsmilie:

any idea or suggestion, i really appreciete :)

build.xml :
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
<!-- for some information on what you could do (e.g. targets to override). -->
<!-- If you delete this file and reopen the project it will be recreated. -->
<project name="Lembayung" basedir=".">
    <description>Builds the module suite Lembayung.</description>
    <import file="nbproject/build-impl.xml"/>    
    
<!-- START OBFUSCATOR ). -->
    <target name="-post-jar">
        <property name="proguard.jar.path" value="/tools/obfuscating/jar/proguard.jar" />
        <!-- 
            C:\Program Files\Java\jre7\bin\javaw.exe   
        -->
        <property name="java.home.path" value="C:/Program Files/Java/jre7/bin"/>
        
        <taskdef resource="proguard/ant/task.properties"
                 classpath="${proguard.jar.path}" />
        
        <echo message="Obfuscating ${dist.jar}..."/>
        <mkdir dir="${build.dir}/obfuscated"/>
        <proguard printmapping="${build.dir}/obfuscated/${application.title}.map"
                  renamesourcefileattribute="SourceFile" ignorewarnings="true">
            
            <!-- Specify the input jars, output jars, and library jars. -->
            <injar  file="${dist.jar}" />
            <outjar file="${build.dir}/obfuscated/BalloonWindCore_JavaSE.jar" />
            
            <libraryjar path="${javac.classpath}" />            
            <libraryjar file="${java.home.path}/jre/lib/rt.jar" />
            
            <!-- Keep some useful attributes. -->

            <keepattribute name="InnerClasses" />
            <keepattribute name="SourceFile" />
            <keepattribute name="LineNumberTable" />
            <keepattribute name="Deprecated" />
            <keepattribute name="*Annotation*" />
            <keepattribute name="Signature" />
            
            <!-- Preserve all public classes, and their public and protected fields and methods. -->

            <keep access="public">
                <field  access="public protected" />
                <method access="public protected" />
            </keep>
            
            
            <!-- Preserve all .class method names. -->

            <keepclassmembernames access="public">
                <method type      ="java.lang.Class"
                        name      ="class$"
                        parameters="java.lang.String" />
                <method type      ="java.lang.Class"
                        name      ="class$"
                        parameters="java.lang.String,boolean" />
            </keepclassmembernames>
            
            <!-- Preserve all native method names and the names of their classes. -->

            <keepclasseswithmembernames>
                <method access="native" />
            </keepclasseswithmembernames>
            
            <!-- Preserve the methods that are required in all enumeration classes. -->

            <keepclassmembers extends="java.lang.Enum">
                <method access="public static"
                        type="**[]"
                        name="values"
                        parameters="" />
                <method access="public static"
                        type="**"
                        name="valueOf"
                        parameters="java.lang.String" />
            </keepclassmembers>
            
            <!-- Explicitly preserve all serialization members. The Serializable
                 interface is only a marker interface, so it wouldn't save them.
                 You can comment this out if your library doesn't use serialization.
                 With this code serializable classes will be backward compatible -->

            <keepnames implements="java.io.Serializable"/>
            <keepclassmembers implements="java.io.Serializable">
                <field  access    ="final"
                        type      ="long"
                        name      ="serialVersionUID" />
                <field  access    ="!static !transient"
                        name      ="**"/>
                <field  access    ="!private"
                        name      ="**"/>
                <method access    ="!private"
                        name      ="**"/>
                <method access    ="private"
                        type      ="void"
                        name      ="writeObject"
                        parameters="java.io.ObjectOutputStream" />
                <method access    ="private"
                        type      ="void"
                        name      ="readObject"
                        parameters="java.io.ObjectOutputStream" />
                <method type      ="java.lang.Object"
                        name      ="writeReplace"
                        parameters="" />
                <method type      ="java.lang.Object"
                        name      ="readResolve"
                        parameters="" />
            </keepclassmembers>
            
            <!-- Your application may contain more items that need to be preserved;
                 typically classes that are dynamically created using Class.forName -->

        </proguard>
    </target>    
<!-- END OBFUSCATOR ). -->

</project>



This post has been edited by cassiopeia: 03 October 2012 - 04:45 AM


Is This A Good Question/Topic? 0
  • +

Replies To: obfuscator proguard in netbeans

#2 cassiopeia  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 86
  • Joined: 03-April 11

Re: obfuscator proguard in netbeans

Posted 03 October 2012 - 11:54 PM

i've found the answer. case closed :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1