I have a problem compilling an example code

Hello. I'm a complete newbie. I was trying to compile this code

import javax.microedition.media.*;

import javax.microedition.amms.control.tuner.*;

import java.util.Date;

import java.io.IOException;

publicclass TunerExample{

Player radioPlayer;

TunerControl tunerControl;

RDSControl rdsControl;

/**

* Initializes and switched on the radio.

*/

void initializeRadio(){

try{

radioPlayer = Manager.createPlayer("capture://radio");

radioPlayer.realize();

radioPlayer.addPlayerListener(new MyPlayerListener(this));

tunerControl = (TunerControl)

radioPlayer.getControl("javax.microedition.amms.control.tuner.TunerControl");

tunerControl.setStereoMode(TunerControl.STEREO);

// Then, let's get the RDSControl:

rdsControl = (RDSControl)

radioPlayer.getControl("javax.microedition.amms.control.tuner.RDSControl");

if(rdsControl !=null){

//Let's turn on the automatic switching

//to possible traffic announcements:

rdsControl.setAutomaticTA(true);

}

radioPlayer.start();

// Now that the radio is on let's first find a radio station

// by seeking upwards from 91.0 MHz:

int freq = tunerControl.seek(910000, TunerControl.MODULATION_FM,true);

if(freq==0){

// no FM broadcasting found, do some error handling here...

return;

}

}catch (MediaException me){

}catch (IOException ioe){

}

}

/**

* Shows on the console some RDS data.

* This method is called from MyPlayerListener.

*/

void updateRDSDisplay(){

if(rdsControl !=null){

String channelName = rdsControl.getPS();

String radioText = rdsControl.getRT();

String programmeType = rdsControl.getPTYString(true);

// update the application UI to show the information:

System.out.println(channelName +", " + radioText);

System.out.println("genre:" + programmeType);

Date date = rdsControl.getCT();

if(date !=null){

System.out.println("The local time is " + date);

}

}

}

}

/**

* Listens RDS_NEW_DATA events and calls TunerExample.updateRDSDisplay

* when such an event is received.

*/

class MyPlayerListenerimplements PlayerListener{

TunerExample tunerExample;

public MyPlayerListener(TunerExample tunerExample){

this.tunerExample = tunerExample;

}

publicvoid playerUpdate(Player player,

java.lang.String event,

java.lang.Object eventData){

if(event == RDSControl.RDS_NEW_DATA){

tunerExample.updateRDSDisplay();

}

}

}

From here - http://www.forum.nokia.com/document/Java_ME_Developers_Library/GUID-D3E35E6F-0C45-48ED-B09D-F716E14C1C02/overview-summary.html

Here is the console code:

Project settings saved

Building "TunerExample"

Build complete

Running with storage root DefaultColorPhone

Running with locale: Bulgarian_Bulgaria.1251

Running in the identified_third_party security domain

Unable to create MIDlet TunerExample

java.lang.InstantiationException: Class not a MIDlet

at com.sun.midp.midlet.MIDletState.createMIDlet(+66)

at com.sun.midp.midlet.Selector.run(+22)

Execution completed.

3435310 bytecodes executed

360 thread switches

1669 classes in the system (including system classes)

17940 dynamic objects allocated (540900 bytes)

2 garbage collections (461320 bytes collected)

It compiles but doesn't run. How can I fix it?

[5906 byte] By [martinmarinova] at [2007-11-27 10:28:21]
# 1

Hey, I want to ask if someone more capable of me can compile it for me and send the jar file (if it's possible to my e-mail address: martintzvetomirov@abv.bg). I will be very grateful. I just want to see if it'll work on my phone (Nokia 6300). 10x in advance!

martinmarinova at 2007-7-28 17:51:09 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

Don't bother. I've succeeded. My phone don't support this method :( It's Nokia 6300

MartinMarinoa at 2007-7-28 17:51:09 > top of Java-index,Java Mobility Forums,Java ME Technologies...