Maheraj
Maheraj

Reputation: 101

How to run an existing MIDP jar file inside another MIDP jar file?

I have a j2me jar file(game). I am told not to change the existing jar file. Now I have to develop a new j2me application which will run the existing jar file based on some conditions. it will be best if I can make a single jar file containing both. plz give me some IDEA and SAMPLE code.

Upvotes: 2

Views: 245

Answers (2)

Maheraj
Maheraj

Reputation: 101

I have finally found that one jar file can not start another. But I have to start one jar file from another based on some conditions. I have solved this problem some other way. One of them is create a new Midlet and extends the exiting one. then call existing constructor from new constructor and start pause and destroy method from new... in this way it is working for me.. but if any one have any better idea plz mention it..

 public class Midlet extends DiceMidlet {
    public Midlet() {
        super();
    }
    public void startApp() {
        for(int i=0;i<1000;i++){
            if(i==999){
                super.startApp();
            }
        }

    }
    public void pauseApp() {
        super.pauseApp();
    }
    public void destroyApp(boolean unconditional) {
        super.destroyApp(unconditional);
    }
 }   

Upvotes: 0

funkybro
funkybro

Reputation: 8671

You can put more than one midlet in a single JAR, just make sure you name each one in the jad file. You cannot start one midlet from another.

Upvotes: 2

Related Questions