SourceForge has been redesigned. Learn more.
Close

Obfus. main class, too.

Help
cvkimball
2012-08-06
2012-12-17
  • cvkimball

    cvkimball - 2012-08-06

    Currently, I'm keeping the main class for the executable jar file.  But I'd like to obfuscate it too, getting the same obfuscated name in the class file directory and in the manifest.

    I've tried adaptresourcefilecontents META-INF/MANIFEST.MF but get a strange message about needing a "keep" as long as I'm "shrinking".

    Here's my current .pro file:
    -injars       /Users/kimball/Projects/Viewer/project/VO_Viewer.jar
    -outjars      /Users/kimball/Projects/Viewer/project/Viewer.jar
    -libraryjars /Users/kimball/Projects/Utilities/proguard4.7/lib/rt.jar
    -printmapping Viewer.map
    -repackageclasses 'Viewer'
    -keep public class Viewer.ViewerMain {
        public static void main(java.lang.String);
    }

    I'd like the name "Viewer" to disappear from the JAR file.

    Thanks,

    Chris

     
  • Eric Lafortune

    Eric Lafortune - 2012-08-09

    The error message suggests that you're not using the right -keep option. Maybe the class name contains a typo? ProGuard should then print a warning. Cfr. ProGuard manual > Troubleshooting > Error: You have to specify '-keep' options.

    For obfuscating the name of the main class:

    -adaptresourcefilecontents META-INF/MANIFEST.MF
    -keep,allowobfuscation public class Viewer.ViewerMain
    -keepclassmembers public class Viewer.ViewerMain {
        public static void main(java.lang.String[]);
    }
    

    Eric

     

Log in to post a comment.