Skip to main content

How to test MIDlets with Ant (Eclipse)

1 reply [Last post]
Joined: 2008-12-07

I'm a newbie and have tried to use Ant to build a midlet and to run it in the WTK emulator.

The emulator starts up with the midlet to be launched. But when I push the launch button, it crashes. If I use WTK to build and run the same source code, there's no problem, the midlet runs nicely.

The build file:

<?xml version="1.0"?>

Connect to WTK

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-15

Most failures in starting java code that compiles is in the classpath.

This tutorial has all of the steps of using the WTK package from commandline.

This link shows different ways to invoke the emulator for different uses:

This link shows different ways to call the emulator using java not the batchfile:

This one shows calling the Nokia emulator:

Most likely your problem is you don't have your classpath pointing to your WTK files, and only standard javaSE class files. While the JavaME has a lot of classes that look the same as SE, they are dramatically different, and must be pointed to for the compiler and emulator to run your MIDlet correctly.

All of your other steps (compile and preverify) have the classref "midp_lib" but your run step only points to the executable files. In looking at the nokia link, we see that in their classpath they have the file before their app jarfile. However the WTK has CLDC1.1 and MIDP2.0 as different files, so you will need those first and in that order, so that base classes are defined ahead of javax.microedition.* classes.