How to create MIDlet in J2ME

개요: Java Mobile Application is called J2ME. Normally when we are working in the mobile technology field then we must think about J2ME application. 이 방법을 통해 우리는 우리의 모바일 응용 프로그램을 개발할 수 있습니다 또한 JAD 또는 jar 파일을 통해 우리의 장치에 설치. 현재 몇 년 동안 휴대 전화 개발에서 가장 큰 향상 JavahostedMIDlets의 도입이었다. 미들 렛은 기본 하드웨어를 추상화와 개발자는 일반적으로 자바 런타임 시스템을 지원하는 장치의 다양한에서 실행 프리젠 테이션을 만들 수있는 자바 가상 머신에서 실행됩니다. 이 부적절 편의 장치 하드웨어에 접근 제한의 가격 온다. 이제 모바일 개발은 전화 제조업체에 의해 작성된 네이티브 응용 프로그램에 주어진 것과 액세스 및 실행 권한을 다른 하드웨어를받을 타사 응용 프로그램에 대한 정상으로 간주되었다. The introduction and implementation of Java MIDlet expanded developers’ audiences. But the lack of low-level hardware access and sandboxed the execution meant that most mobile applications are regular to desktop programs or web sites designed to render on a smaller screen.

In this article MIDlet creation will be discussed in details.

소개: J2ME abbreviation as Java 2, Micro Edition. It is a functional version of the Java besieged at devices which have limited treating power and storage aptitudes and alternating or fairly low-bandwidth network connections system. These systems also include mobile phones, pagers, wireless devices that are normally used in our daily life. MIDlets are part of the applets for mobile phones system. Here applets which can run in a protected sandbox. This system is extremely limited for that process. The MIDP ( ) 1.0 is currently found on most Java-capable phones and is fairly good. As an example – the KVM doesn’t allow us to process the floating point numbers yet and MIDlets written for MIDP 1.0 cannot access anything outside of the sandbox without proprietary APIs (Application Programming System.) from phone makers. Now we can put our dreams for developing the ultimate MIDlet with hooks into each part of our phone Operating System on the backburner. Basically when we want to find out exactly that how limited MIDP 1.0 is present then we should probably read the spec here. If we do it then it might want to check out MIDP 2.0 version and it’s up gradation. Here the time being we are going to write our first MIDlet – a full-featured like “Hello MIDlet” application.

The MIDlet Lifecycle:
Every system should have lifecycle and through this life cycle we can recognize the step by step process of the system. Here we shortly discuss MIDlet Lifecycle Mobile devices like emulators or real that can interact with a MIDlet using their own software technology process known as Application Management Software (Abbreviated as AMS). The AMS is responsible for initializing, starting, pausing, resuming, and destroying a MIDlet. AMS may be responsible for installing and removing a MIDlet. To facilitate this life cycle management, a MIDlet can be in one of three states which are controlled via the MIDlet class methods that every MIDlet extends and overrides. These states are split up with different part like active, paused and destroyed.

Virtual Machines:
Generally these types of programming model Virtual Machine or Virtual Device also take a vital role in the software development section. Now the CLDC (J2ME Connected, Limited Device Configuration) and the CDC (J2ME Connected Device Configuration) necessitate their own virtual machine because of their altered memory and displayed the capabilities. The CLDC virtual machine is smaller than that required by the CDC and supports fewer features. In that sense the virtual machine for the CLDC is called the Kilo Virtual Machine (KVM) and the virtual machine for the CDC is called the CVM.

J2ME Connected, Limited Device Configuration

  • 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 Device Configuration

  • 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) 그 이유로 우리는 다운로드와 Java SE 개발 키트의 최신 32 비트 버전을 설치해야합니다 (JDK) first. JDK의 코드를 실행하는 자바 클래스를 컴파일 할 필요. 인터넷 콩 설치 가이드를 설치하는 동안 로컬 드라이브에 JDK의 위치를 ​​검색하는 데 사용되는 요청.

ð이 점은 우리가 인터넷 콩을 설치할 때 우리는 주문형 옵션 설치 및 명확한 theFeatures을 사용자 정의 선택하는 것이 기억해야한다. 다운로드하고 소프트웨어 개발 키트를 설치 (SDK) 즉, 자바 ME를 지원합니다 (Micro Edition). 이 SDK는 IDE가 특정 장치 플랫폼을위한 건물 미들 릿에 대한 관련 자바 ME 클래스 라이브러리를 제공합니다.

사실 우리는 시리즈의 미들 릿을 생성 할 때 40 장치는 우리는 노키아 SDK를 사용하여 (소프트웨어 개발 키트) Java 용. Now if we want to create MIDlets for Series 40, 6th edition, or earlier Series 40 devices then use the corresponding Series 40 SDK.

ð Remember that SDK is properly integrated with the IDE and also install the SDK on the same logical drive as the IDE section.

Process to configure Net Beans: After installing the required software integrate Net Beans with the installed SDK:

Here we will discuss step by step process to create the project

  1. Open Net Beans (Version 7.2.1 it may be changed according software update process
  2. Select Tools-> Java Platforms.
  3. Click Add Platform.
  4. Select Java ME CLDC Platform Emulator and click next. Net Beans searches our computer for SDKs that support Java ME.
  5. Select 파일> New Project.
  6. Select Java ME -> Mobile Application and click next.

Figure 1: Selecting the Java platform type

  1. If we do not find the SDK (소프트웨어 개발 키트) in Net Beans IDE then click Find More Java ME Platform Folders and select the folder where we installed the SDK. Net Beans searches the selected folder for SDKs (Software Development Kits) that support Java ME (Micro Edition).
  2. Select the SDK and click Next -> Net Beans detects the SDK capabilities.

Figure 2: Adding a Series 40 소프트웨어 개발 키트

  1. After the completion click configuration -> click Finish and then Close.
  2. Your development environment is now set and you can create the MIDlet in Net Beans.

To create the HelloBCEI MIDlet:

  1. Download and install Netbeans (select an installation bundle that supports Java Micro Edition).

In this Project Name field, enter “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. 에뮬레이터 플랫폼 드롭 다운 메뉴 옵션에서, 당신이 미들 릿을 만들려는 장치 플랫폼을 선택:

그 시리즈 40 devices, 여기에 우리가 자바에 대한 노키아 소프트웨어 개발 키트를 선택.

Figure 4: 미들 렛의 장치 플랫폼을 선택

  1. CLDC 1.1과 MIDP 2.0을 선택. 우리는 또한 MIDP-2.1을 선택하고 클릭 수 . NetBeans는 우리를 위해 미들 릿 프로젝트를 설정.

지금은 다음과 같은 방법을 통해 프로그램을 만드는 오전.

  1. 미들 렛의 기본 클래스를 만들려면, [파일] -> 새 파일.
  2. CLDC를 선택합니다 -> 미들 릿하고 다음을 클릭합니다.
  3. 미들 릿 이름 필드에, enter “HelloBCEI”.
  4. MIDP의 클래스 이름 필드에, enter “HelloBCEIMIDlet”.
  5. Click .

HelloBCEI MIDlet 클래스는 기본 패키지에 생성됩니다. 여기에서 우리는 그 코드가 프로그램에서 생성 된 코드를 적어.

목록 1: 보기 MIDlet 클래스

수입 javax.microedition.lcdui.Display;
수입 javax.microedition.lcdui.Displayable;
import javax.microedition.midlet.MIDlet;

public class HelloMIDlet extends MIDlet
{
public HelloWorldMIDlet()
{

}
// Sets the MIDlet’s current Display to a HelloScreen object.
public void startApp()
{
Displayable current = Display.getDisplay(this).getCurrent();
면 (current == null)
{
HelloScreen helloScreen = new HelloScreen(this, “안녕하세요, BCEI!”);
Display.getDisplay(this).setCurrent(helloScreen);
}
}
public void pauseApp()
{

}
public void destroyApp(boolean unconditional)
{

}
}

I. To create the HelloBCEIScreen class, select File -> 새 파일.

  1. II. Select Java-> Java Class and click Next.
  2. III. In the Class Name field, enter “HelloBCEI”.
  3. IV. Click . The HelloBCEI class is created in the default package.

Listing2: Shown class created in default package

import javax.microedition.lcdui.*;

class HelloBCEIScreen extends Form implements 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)
{
슈퍼(“”);
StringItem helloText = new StringItem(“”, string);
super.append(helloText);
this.midlet = midlet;
exitCommand = new Command(“Exit”, Command.EXIT, 1);
addCommand(exitCommand);
setCommandListener(this);
}

public void commandAction(Command command, Displayable displayable)
{
면 (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 project viewed in the Projects pane

Debugging a MIDlet

Before we can debug a MIDlet, we must have versions of the MIDP executable and the MIDlet that has debugging cryptogram in their class files. To see whether we have an acceptable version of the midp executable and run the midp command in the midst of the -help option. If the generated executable has Java debugging capabilities then we will see the -debugger option listed below. For example:

 

C:\midp2.0fcs> 빈 MIDP -help,en

용법: midp [<options>]

Run the Graphical MIDlet Suite Manager….

or midp [<options>] -debugger …

 

The version of the midp executable that we are using does not support Java programming language debugging. To produce a version of the MIDlet that contains debugging symbols we use the –g option to the javac (compiler of the Java) command.

To debug a MIDlet following steps should be followed up one by one:

1. at first open a command prompt or terminal window.

2. Change our current directory to midpInstallDir.

For illustration, if the MIDP Reference accomplishment were installed in the directory

C:\midp2.0fcs we can run the command:C:\> cd midp2.0fcs

3. Start the MIDP Reference accomplishment and executable in debug mode.

Use the midp command in the midst of the switches -debugger and -port. The port number should be 2800. Here the port number on which the KVM debug proxy expects the debugger to be running.

Reference Implementation executable. For example:

C:\midp2.0fcs ,,ca,빈 MIDP -debugger -port,,en> bin\midp -debugger -port 2800 -classpath classes

4. Now Start the KVM debug proxy.

Check the KVM documentation for information on the correct syntax, 논쟁, and options. For specimen, the following command has the KVM debug proxy connect to the midp executable that we started in the previous step and then listen at port 5000 for software compliant with the Java™ Platform Debugger Architecture process:

[코드]

C:\midp2.0fcs ,,ca,빈 MIDP -debugger -port,,en> java -jar

C:/kvm/bin/kdp.jar kdp.KVMDebugProxy –l 5000 -p -r localhost 2800 -cp

[/코드]

Paths Including MIDletClassFiles

5. Connect to the KVM debug proxy from any debugger compliant with the Java Platform Debugger Architecture. The Compliant debuggers include jdb, Sun™ ONE Studio (formerly known as Forte™ for Java), JBuilder, Code Warrior, Visual Café etc.

Deploy the Project

Now we will be discussing about the deployment process. We have reached the stage where we can deploy the MIDlet directly on our mobile device and also run it. Basically there are two ways to do this. Naturally the first is via a network connection between our computer and our handset device. This process can either be via a USB (Universal Serial Bus) cable or a Bluetooth wireless connection and depending on our device. Most of Java-enabled devices will allow us to install J2ME applications via this connection.

둘째, the one that is more motivating chapter because it opens up our MIDlet to the outside world via the Internet system. Generally, this means that our device should be able to connect to the Internet using its internal browser.

[CODE]

<HTML>
Click <a href=”DateTimeAppliction.jad”>here</에이> to download DateTimeApplication MIDlet!
</HTML>

[CODE]

Processing to get the code in the our own device:

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.

결론: 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

============================================= ============================================== 아마존에서 최고의 Techalpine 책을 구입하십시오,en,전기 기술자 CT 밤나무 전기,en
============================================== ---------------------------------------------------------------- electrician ct chestnutelectric
error

Enjoy this blog? Please spread the word :)

Follow by Email
LinkedIn
LinkedIn
Share