3 Replies Latest reply on Nov 26, 2008 8:52 AM by handler

    Using Javassist on J2ME MIDlets

    marcilgen

      I would like to use Javassist to modify existing JAD/JAR files for J2ME MIDlets. (Yes I will have permission from the vendor to do this - all the legal considerations are taken care of). Basically I want to display some things to the user before the actual MIDlet runs. I plan to add some extra classes to the MIDlet that do this. These extra classes use basic MIDP 1.0 functionality, nothing fancy at all. But to make the existing MIDlet call these classes, I will need to modify the class specified in the JAD file that extends MIDlet. Let me call this the "original MIDlet class". I need to modify the original MIDlet class startApp() method so that the first thing it does when the app gets launched is to call a method in my extra classes to show this code to the user. When the code in the extra class finishes, it will call the original MIDlet startApp() method again, which will know this time just to execute what was originally there, ie to load and launch the game or app in the MIDlet. I left out a few details but I think you get the idea.

      Here are my questions.
      How exactly do I run Javassist on a JAR file?
      The MIDlet JAR file contains preverified classes. Can I use Javassist on preverified classes?
      It looks like Javassist writes the modified class back out to disk. I want to get the modified class file, preverfied, back into the JAR file. What must I do to do this? Must I preverify everything again? Or is the new class already preverified?