how to overcome Invalid jar size exception


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 10 of 10

Thread: how to overcome Invalid jar size exception

  1. #1
    Join Date
    Jul 2005
    Posts
    54

    how to overcome Invalid jar size exception

    hi,
    i did one j2me application.After finishing tht project i tried to created obfuscated package to load my application.while creating package the following exception occurs

    Error preverifying class k
    Class loading error: Wrong name
    com.sun.kvem.ktools.ExecutionException: Preverifier returned 1
    Build failed
    com.sun.kvem.midletsuite.InvalidJadException: Reason = 31
    The jar size value in the Application Descriptor does not match the real jar file size.
    can anyone tell me how to eliminate this exception n y this exception occurs?
    thanx a lot

  2. #2
    Join Date
    Nov 2003
    Posts
    4,118
    It's an interesting question. My best is that the JAR size mismatch error is a red herring. The sizes don't match because of a different error that occurs earlier, and which isn't detected on time. Try to isolate the problem by creating a very small and simple JAR file that contains only one class and see if you're getting the same error message.
    Danny Kalev

  3. #3
    Join Date
    Jul 2005
    Posts
    54
    hi,
    thanx for ur reply.i eliminate tht exception by reducing the no of class in my application

  4. #4
    Join Date
    Nov 2003
    Posts
    4,118
    how many classes were in the original jar file? how many do you have now? hust curious.
    Danny Kalev

  5. #5
    Join Date
    Jul 2005
    Posts
    54
    hi
    first i had 16 classes n i reduced tht to 13 class
    then it starts working properly

  6. #6
    Join Date
    Nov 2003
    Posts
    4,118
    Wierd. I would have thought that a JAR file could happily live with 16 classes, but I guess it depends on the total jar file size, which may be rather limited on this environment. Anyway, I'm glad you were able to solve this problem.
    Danny Kalev

  7. #7
    Join Date
    Nov 2005
    Posts
    1

    the same problem that doesnt solving yet

    i have the same problem with you laxmi..

    i got the error when going obfuscating my program..
    the following error occurs:

    Project settings saved
    Building "RemoteExecMidlet"
    Build complete
    Project settings saved
    Building "RemoteExecMidlet"
    ProGuard, version 3.3
    Reading program jar [/srv/WTK2.1/apps/RemoteExecMidlet/bin/RemoteExecMidlet.jar]
    Reading library jar [/srv/WTK2.1/lib/midpapi20.jar]
    Reading library jar [/srv/WTK2.1/lib/wma.jar]
    Reading library jar [/srv/WTK2.1/lib/cldcapi10.jar]
    Preparing output jar [/tmp/RemoteExecMidlet.jar]
    Copying resources from program jar [/srv/WTK2.1/apps/RemoteExecMidlet/bin/RemoteExecMidlet.jar]
    Note: duplicate definition of library class [com.sun.cldc.i18n.j2me.UTF_8_Reader]
    com.sun.kvem.ktools.ExecutionException: Preverifier returned 1
    Build failed
    com.sun.kvem.midletsuite.InvalidJadException: Reason = 31
    The jar size value in the Application Descriptor does not match the real jar file size.
    Error preverifying class com.jcraft.jsch.A
    VERIFIER ERROR com/jcraft/jsch/A.a(Lcom/jcraft/jsch/fZ:
    Incompatible object argument for function call
    ----------------------------------------------------------------------

    could anybody help me?
    my program is remoteExecMIDlet that have 56 classes, how can i eliminate the no of classes, cause there is still over 25 classes...

    i have try to obfuscating the program .. and i have that error...

  8. #8
    Join Date
    Nov 2003
    Posts
    4,118
    try to do what laxmi did: reduce the number of classes, removing one class at a time, until the exception disappears. You can avoid some classes by collpasing two or three related classes into one. It's not an ideal OOP style but there's no escape from it I guess...
    Danny Kalev

  9. #9
    Join Date
    Jan 2006
    Posts
    1

    -dontusemixedclasses

    A little late answer but since I ran into the same problem, yesterday, I thought I would drop the answer that worked for me.

    As stated in the proguard documentation :
    "You must preverify your midlets after having processed them, using J2ME's preverify tool. Because this tool unpacks your processed jars, you should use ProGuard's -dontusemixedcaseclassnames option on platforms with case-insensitive filing systems, such as Windows."

    The problem comes from the fact that proguard, withouth the option, uses uppercase names equal to already existing lowercase classes and that the preverify tool is not able to work it out.

  10. #10
    Join Date
    Nov 2003
    Posts
    4,118
    thanks, that certainly explains what the problem is. That said, I wish that the exception message would be a tad more specific. Who on earth could have guessed that that was the cause of this problem?
    Danny Kalev

Similar Threads

  1. Replies: 7
    Last Post: 12-18-2006, 02:03 PM
  2. Jar Packaging
    By Ketan Taylor in forum Java
    Replies: 0
    Last Post: 12-13-2002, 06:17 AM
  3. SQL Exception: Invalid Handle
    By DM in forum Java
    Replies: 0
    Last Post: 12-07-2001, 05:45 AM
  4. Replies: 2
    Last Post: 03-07-2001, 08:25 PM
  5. Making a single jar file from differnet packages
    By M.S.Ramagopal in forum Java
    Replies: 0
    Last Post: 05-02-2000, 03:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center