×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    3

    Obfuscation batch file woes

    I should have figured this out by now, but I'm having problems getting an obfuscated jar file to run properly.

    Symptoms:
    - java.lang.ClassNotFoundException indicating that it can't find the entry class
    - This only happens when the classes belong to a package (problem does not occur when the source is all in the base directory)
    - The unobfuscated jar runs fine.

    For example:
    java.lang.ClassNotFoundException: net.company.gamepackage.GameClass
    when there is in fact a class file:
    net/company/gamepackage/GameClass.class in the jar file.

    For what it's worth, I'm working on a Motorola v300 build can can't recall if it happens on other handsets.

    Also, I'm using ProGuard.

    Any thoughts?

  2. #2
    Regular Contributor
    Join Date
    Aug 2003
    Location
    uk
    Posts
    232
    My bash script (similar to batch files) reads like this:

    # CLASSLIB = location of phone specific libraries
    export CLASSLIB="C:/java/Motorola/SDK4.1/EmulatorA.1/lib/stubclasses.zip;C:/java/Motorola/SDK4.1/EmulatorA.1/lib/javaextensions.jar"

    # midpapi = just the generic midp-1.0 libraries
    # PROGFILENAME = name of input jar
    # out.jar contains onfiscated code

    java -jar C:/java/proguard2.1/lib/proguard.jar -libraryjars "$CLASSLIB;bin/lib/midpapi.zip" -overloadaggressively -defaultpackage '' -injars $PROGFILENAME.jar -outjar out.jar -keep "public class * extends javax.microedition.midlet.MIDlet" 2> proguard.log

  3. #3
    Registered User
    Join Date
    Dec 2004
    Posts
    3
    I figured out what my problem was. It works now that I added -defaultpackage (full package path) to the proguard options. I thought I had tried that before, but it works now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×