How to create MIDlet in J2ME

Apèsi sou lekòl la: Java Mobile Application is called J2ME. Normally when we are working in the mobile technology field then we must think about J2ME application. Through this way we can develop our mobile application and also install it in our device through the jad or jar file. In current years the largest enhancement in mobile phone development was the introduction of JavahostedMIDlets. MIDlets are executed on a Java virtual machine that abstracts the underlying hardware and lets developers create presentations that run on the wide variety of devices that generally supports the Java run time system. Inappropriately this convenience comes at the price of restricted access to the device hardware. Koulye a, nan devlopman nan mobil li te konsidere kòm nòmal pou aplikasyon pou twazyèm-pati yo resevwa diferan pyès ki nan konpitè jwenn aksè ak ekzekisyon dwa soti nan sa yo bay yo pou aplikasyon pou natif natal ekri pa manifaktirè yo telefòn '. Entwodiksyon an ak aplikasyon nan Java MIDlet elaji odyans devlopè '. Men, mank nan ki ba-nivo aksè kenkayri ak sandboxed ekzekisyon an vle di ke pi aplikasyon pou mobil yo regilye nan pwogram Desktop oswa sit wèb ki fèt yo rann sou yon ekran pi piti.

Nan atik sa a pral MIDlet kreyasyon dwe diskite nan detay.

Entwodiksyon: J2me abrevyasyon kòm Java 2, Mikwo edisyon. Li se yon vèsyon fonksyonèl nan Java nan sènen nan aparèy ki gen limite trete pouvwa ak depo aptitudes ak altène oswa san patipri ki ba-Pleasant rezo koneksyon sistèm. Nan sistèm sa yo gen ladan l tou telefòn mobil, bipè, aparèy san fil ke yo nòmalman yo itilize nan lavi chak jou nou an. MIDlets se yon pati nan applets yo pou mobil sistèm telefòn. Isit la applets sa ki ka kouri nan yon sandboks pwoteje. Sa a se sistèm trè limite pou pwosesis ki. MIDP nan ( ) 1.0 se kounye a yo te jwenn sou pi fò nan telefòn Java-kapab ak se san patipri bon. Kòm yon egzanp – Kvm a pa pèmèt nou nan pwosesis nimewo yo pwen k ap flote ankò ak MIDlets ekri pou MIDP 1.0 pa ka jwenn aksè anyen deyò nan sandboks la san yo pa APIs propriétaires (Aplikasyon pou pwogramasyon System.) soti nan mizisyen telefòn. Koulye a, nou ka mete rèv nou pou devlope ultim MIDlet a ak bayonn nan chak pati nan sistèm operasyon telefòn nou an sou backburner a. Fondamantalman lè nou vle chèche konnen egzakteman sa ki jan limite MIDP 1.0 se prezan lè sa a nou ta dwe pwobableman li espèk a isit la. Si nou fè l 'lè sa a li ta ka vle tcheke deyò MIDP 2.0 vèsyon epi li moute pwogresyon. Isit la kounye a nou pral ekri premye MIDlet nou an – yon plen Anons Spesyal tankou “Alo MIDlet” aplikasyon.

Lifecycle nan MIDlet:
Chak sistèm ta dwe gen lifecycle ak nan sa a sik lavi nou ka rekonèt etap la nan pwosesis etap nan sistèm nan. Isit la nou yon ti tan diskite sou MIDlet Lifecycle mobil aparèy tankou Emulation oswa byen ki ka kominike avèk yon MIDlet lè l sèvi avèk pwòp pwosesis teknoloji lojisyèl yo li te ye tankou aplikasyon lojisyèl Jesyon (Abreje kòm AMS). AMS la responsab pou inisyalizin, kòmanse, poz, reprenan, ak detwi yon MIDlet. AMS kapab responsab pou enstale ak retire yon MIDlet. Pou fasilite sa a jesyon sik lavi, yon MIDlet ka nan youn nan twa lòt eta ki fè yo kontwole via metòd yo klas MIDlet ke chak MIDlet fin ak Vanport. eta sa yo fann moute ak diferan pati tankou aktif, Sarepta ak detwi.

pou machin avanse Virtual:
Anjeneral sa yo kalite modèl pwogram Virtual Machine oswa Virtual Aparèy tou pran yon wòl enpòtan nan seksyon an devlopman lojisyèl. Koulye a, CLDC la (j2me konekte, Limited Aparèy konte genyen) ak CDC a (J2me Connected Aparèy konte genyen) nesesita pwòp yo machin vityèl paske nan memwa chanje yo ak parèt kapasite yo. CLDC machin nan vityèl se pi piti pase ki te mande pou pa CDC a ak sipò mwens karakteristik. Nan sans sa se machin nan vityèl pou CLDC a rele Kilo Virtual Machine nan (kvm) epi li se machin nan vityèl pou CDC a rele CVM a.

j2me konekte, Limited Aparèy konte genyen

  • It is used to specify the Java environment for mobile phone, pager and wireless devices as well as support other devices also.
  • CLDC devices are usually wireless that means mobility system is supported via CLDC
  • Memory requirement is very much important in that particular device such that 160 – 512k of memory available for Java.
  • Energy saver system has limited power or battery operated capability.
  • Communication process is very important here. The network connectivity is wireless, intermittent, low-bandwidth (9600bps or less).

J2me Connected Aparèy konte genyen

  • Generally it describes the Java environment for the digital television set-top boxes, mobile, high end wireless devices and automotive telemetric systems.
  • The device is powered by a 32-bit processor supported system.
  • 2MB or more memory is available for the Java platform.
  • The network connectivity that are often wireless, discontinuous, low-bandwidth (9600bps or less)

Process to Create our own MIDlet in Net Beans

Generally when we work in the Net Beans field then we have to install Java SE Development Kit (jdk) for that reason we must Download and install the latest 32–bit version of Java SE Development Kit (jdk) first. The JDK is required for compiling the Java classes to execute the code. The Net Beans installation Guide asks that is used to browse to the JDK location on the local drive during installation.

ð This point should be remembered that when we are installing Net Beans then we select to customize the installation and clear theFeatures ON-Demand option. Then download and install a software development kit (SDK) that supports Java ME (Mikwo edisyon). Sdk a bay bibliyotèk klas Java ME ki IDE la enplike nan pou MIDlets bilding pou yon platfòm aparèy an patikilye.

Aktyèlman lè nou jenere MIDlets yo pou Seri an 40 aparèy nou itilize yon Nokia sdk (Twous Devlopman Software) pou Java. Koulye a, si nou vle kreye MIDlets pou Seri 40, 6th edisyon, oswa pi bonè Seri 40 aparèy Lè sa a, sèvi ak Seri ki koresponn lan 40 SDK.

Ð Sonje ke sdk se byen entegre ak IDE a ak tou enstale sdk a sou kondwi a menm lojik kòm seksyon an IDE.

Pwosesis nan konfigirasyon Pwa Filè: Apre enstale lojisyèl yo egzije entegre Pwa Filè ak sdk a enstale:

Isit la nou pral diskite sou etap pa pwosesis etap yo kreye pwojè a

  1. Louvri Pwa Filè (Version 7.2.1 li ka chanje selon lojisyèl pwosesis aktyalizasyon
  2. chwazi Zouti-> Java Lajè platfòm.
  3. Klike sou ajoute platfòm.
  4. chwazi Java ME CLDC platfòm Emulator , epi klike pwochen. Pwa Filè fouy konpitè nou an pou SDKs ki sipòte Java ME.
  5. chwazi file> nouvo Pwojè.
  6. chwazi Java ME -> Mobile aplikasyon , epi klike pwochen.

Figure 1: Chwazi kalite a platfòm Java

  1. Si nou pa jwenn sdk a (Twous Devlopman Software) nan Pwa Filè IDE puis cliquez Jwenn Plis Java ME platfòm Dosye epi chwazi dosye a kote nou enstale sdk a. Pwa Filè fouy dosye a chwazi pou SDKs (Kits Devlopman Software) ke sipò Java ME (Mikwo edisyon).
  2. Chwazi sdk a, epi klike Next -> Pwa Filè detekte kapasite yo sdk.

Figure 2: Ajoute yon Seri 40 Twous Devlopman Software

  1. Apre configuration la, te fini klike sou -> klike sou Fini ak Lè sa a Fèmen.
  2. se anviwònman devlopman ou an kounye a mete ak ou kapab kreye MIDlet la nan Pwa Filè.

Pou kreye HelloBCEI MIDlet la:

  1. Download yo ak enstale neban (chwazi yon pake enstalasyon ki sipòte Java Mikwo edisyon).

Nan ka sa jaden Pwojè Non, antre nan “HelloBCEI”.

Figure 3: Creating your first MIDlet in Net Beans

  1. Clear the checkbox Create Default Package and Main Executable Class.
  2. Click Next. The MIDlet setup continues with device platform selection.
  3. In the Emulator Platform drop-down menu option, select the device platform for which you want to create the MIDlet:

For those Series 40 aparèy, here we select a Nokia Software Development Kit for Java.

Figure 4: Choosing the device platform for the MIDlet

  1. Select CLDC-1.1 and MIDP-2.0. We may also select MIDP-2.1 and Click Finish. NetBeans sets up the MIDlet project for us.

Now I am creating the program through the following way.

  1. To create the main class for the MIDlet, select File -> New File.
  2. Select CLDC -> MIDlet and click next.
  3. In the MIDlet Name field, antre nan “HelloBCEI”.
  4. In the MIDP Class Name field, antre nan “HelloBCEIMIDlet”.
  5. Klike sou Finish.

The HelloBCEI MIDlet class is created in the default package. Isit la nou ekri kòd la se ke Kòd pwodwi nan pwogram nan.

Listing1: Showing klas MIDlet

enpòte javax.microedition.lcdui.Display;
enpòte javax.microedition.lcdui.Displayable;
enpòte javax.microedition.midlet.MIDlet;

klas piblik HelloMIDlet fin MIDlet
{
HelloWorldMIDlet piblik()
{

}
// Ansanm aktyèl Display MIDlet a nan yon objè HelloScreen.
piblik anile startApp()
{
Afichabl aktyèl = Display.getDisplay(sa a).getCurrent();
si (aktyèl == nil)
{
HelloScreen helloScreen = nouvo HelloScreen(sa a, “Alo, BCEI!”);
Display.getDisplay(sa a).setCurrent(helloScreen);
}
}
piblik pauseApp anile()
{

}
piblik destroyApp anile(Boolean san kondisyon)
{

}
}

mwen. Pou kreye klas la HelloBCEIScreen, select file -> New File.

  1. II. chwazi Java-> Java Gwoup , epi klike Next.
  2. III. Nan jaden an Gwoup Non, antre nan “HelloBCEI”.
  3. IV. Klike sou Finish. Se klas la HelloBCEI ki te kreye nan pakè a default.

Listing2: Montre klas ki te kreye nan pake default

enpòte javax.microedition.lcdui *.;

klas HelloBCEIScreen fin Fòm aplike CommandListener
{
private final HelloBCEIMIDlet midlet;
private final Command exitCommand; //Exit command for closing the MIDlet in the device UI.

public HelloBCEIScreen(HelloWorldMIDlet midlet, String string)
{
super(“”);
StringItem helloText = new StringItem(“”, string);
super.append(helloText);
this.midlet = midlet;
exitCommand = new Command(“Exit”, Command.EXIT, 1);
addCommand(exitCommand);
setCommandListener(sa a);
}

public void commandAction(Command command, Displayable displayable)
{
si (command == exitCommand)
{
midlet.notifyDestroyed();
}
}
}

Save the project by selecting file -> Save All.

In the Project pane, right-click the HelloBCEI project and select Deploy option. After selecting the deploy option the program is ready to install in the device.

NetBeans builds the MIDlet and creates the JAR and JAD files used for deploying the MIDlet to a device. You can also find the generated files in the Files pane under the dist folder.

Figure 5: HelloBCEI pwojè wè nan fenèt la Pwojè

Debogaj yon MIDlet

Anvan nou ka debug yon MIDlet, nou dwe gen vèsyon an ègzèkutabl a MIDP ak MIDlet a ki te debogaj kriptogram nan dosye klas yo. Pou wè si wi ou non nou gen yon vèsyon ki akseptab pou ègzèkutabl a MIDP epi kouri yo lòd, ki MIDP nan mitan an nan opsyon nan -help. Si ègzèkutabl a pwodwi gen kapasite debogaj Java Lè sa a, nou pral wè opsyon nan -debugger nan lis anba a. For example:

 

C:\midp2.0fcs> bin MIDP -help

itilizasyon: MIDP [<opsyon>]

Kouri Manadjè a Grafik MIDlet Suite….

oswa MIDP [<opsyon>] -debugjeur …

 

Vèsyon an nan ègzèkutabl a MIDP ke nou ap lè l sèvi avèk pa sipòte Java lang programmation debogaj. Yo pwodwi yon vèsyon nan MIDlet an ki gen senbòl debogaj nou itilize opsyon nan -G javak la (du nan Java nan) lòd.

Debug yon MIDlet swiv etap yo ta dwe swiv li youn pa youn:

1. nan premye louvri yon èd memwa lòd oswa fenèt tèminal.

2. Chanje anyè nou an ki ajou midpInstallDir.

Pou ilistrasyon, si yo te reyalizasyon yo MIDP Referans enstale nan anyè a

c:\midp2.0fcs nou ka kouri yo lòd, ki:c:\> CD midp2.0fcs

3. Kòmanse reyalizasyon yo MIDP Referans ak ègzèkutabl nan mòd dbug.

Sèvi ak yo lòd, ki MIDP nan mitan an nan switch yo -debugger ak -port. Nimewo a pò yo ta dwe 2800. Isit la nimewo a pò ki te sou proxy a kvm dbug espere debugjeur a yo dwe kouri.

Referans Aplikasyon ègzèkutabl. For example:

c:\midp2.0fcs > bin MIDP -debugger -port 2800 -klas klaspat

4. Koulye a, Kòmanse proxy a kvm dbug.

Tcheke dokiman an kvm pou enfòmasyon sou sentaks ki kòrèk la, agiman, ak opsyon. Pou echantiyon, lòd sa a te proxy a kvm dbug konekte avèk ègzèkutabl a MIDP ke nou te kòmanse nan etap anvan an ak Lè sa a koute nan pò 5000 pou lojisyèl konfòme ak pwosesis la Java ™ platfòm Debugjeur Achitekti:

[Kòd]

c:\midp2.0fcs > java -jar

c:/kvm / bin / kdp.jar kdp.KVMDebugProxy -l 5000 -p -r localhost 2800 -CP

[/Kòd]

Chemen Ki gen ladan MIDletClassFiles

5. Konekte sou proxy a kvm dbug nan nenpòt debugjeur konfòme ak Java platfòm Debugjeur Achitèk nan. debogeur yo Konfòm gen ladan JDB, Solèy ™ ONE Studio (Anvan li te ye kòm Forte ™ pou Java), JBuilder, Kòd Warrior, Vizyèl Café elatriye.

Deplwaye Pwojè a

Koulye a, nou pral diskite osijè pwoblèm sou pwosesis la deplwaman. Nou te rive jwenn etap nan kote nou ka deplwaye MIDlet la dirèkteman sou aparèy mobil nou yo ak tou kouri li. Fondamantalman ki te gen de fason yo fè sa. Natirèlman premye a se atravè yon koneksyon rezo ant konpitè nou an ak aparèy appareil nou an. Pwosesis sa a ka swa gen atravè yon USB (Universal Serial Otobis) kab oswa yon koneksyon san fil Bluetooth ak depann sou aparèy nou an. Pifò nan aparèy Java ki pèmèt pral pèmèt nou enstale aplikasyon pou j2me via koneksyon sa a.

Dezyèm, yon sèl la ki se pi plis motivasyon chapit paske li ouvè MIDlet nou an nan mond lan deyò via sistèm sou entènèt la. Anjeneral, sa vle di ke aparèy nou an ta dwe kapab konekte sou entènèt la lè l sèvi avèk navigatè entèn li yo.

[KÒD]

<HTML>
Klike sou <a href =”DateTimeAppliction.jad”>isit la</yon> nan download DateTimeApplication MIDlet!
</HTML>

[KÒD]

Otomatik yo ka resevwa kòd la nan aparèy la pwòp nou:

When we have created our gorgeous little MIDlet and ensured that everything worked smoothly in the emulator and the next step is to get it running on an actual device.

Over The Air (OTA) Provisioning:

OTA provisioning that allows users to download our application wirelessly using the WAP browsers built into their phones (mobile). To start it we need to take a look at the Java Application Descriptor (JAD) file that is produced when we package a MIDlet using the J2ME Wireless Toolkit. When we edit a JAD file by means of the Wireless Toolkit then we must open our project and also click on Settings option. That will open up a new window with a number of tabs – API Selection, Required, Optional, User Defined, MIDlets, Push Registry and Permissions.

These all types of Application are very vital and important in our working field. Following table gives brief idea.

Konklizyon: In the above discussion we have got knowledge on the Java Micro Edition. We know that this Edition is suitable for the mobile software development platform. Because when we are working in the mobile software based technology then J2ME is very much reliable and helpful for us. If we are working in that particular filed as a mobile software developer then Java platform is highly secured.

Hope you have got the understanding of the MIDlet creation and its practical implementation. Keep watching in TechAlpine !!



best saudi arbia flight academy usa www.flightschoolusa.com Florida Flyers is the best flight school and flight academy for Saudi Arabia and international flight students

============================================= ============================================== Buy best TechAlpine Books on Amazon
============================================== ---------------------------------------------------------------- electrician ct chestnutelectric
error

Enjoy this blog? Please spread the word :)

Follow by Email
LinkedIn
LinkedIn
Share