Skip to main content

How to test MIDlets with Ant (Eclipse)

1 reply [Last post]
perarve
Offline
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.
sfitzjava
Offline
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.
http://today.java.net/pub/a/today/2005/02/09/j2me1.html?page=2

This link shows different ways to invoke the emulator for different uses:
http://www.mobilefish.com/emulators/j2me_wt/j2me_wt_quickguide_22_emulat...

This link shows different ways to call the emulator using java not the batchfile:
http://www.informit.com/articles/article.aspx?p=131117&seqNum=4

This one shows calling the Nokia emulator:
http://discussion.forum.nokia.com/forum/showthread.php?t=20633

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 classes.zip 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.

-Shawn