Thursday, October 07, 2010

Netbeans for Mobile App

The following is just a brief introduction to Java ME and features in Netbeans 6.9.x.

Updated: I have created a new blog on how to develop Java ME games using Netbeans 6.9.x:

http://mpgddmgd.blogspot.com/

Content:

  • Lab 01: My First MIDlet for Java ME Application
  • Lab 02: Packaging and Deployment

Reference:

http://netbeans.org/features/javame/

http://netbeans.org/kb/docs/javame/quickstart.html

http://www.forum.nokia.com/Develop/Java/Getting_started/Step_5_Find.xhtml

http://www.openclassworld.org/javame

Netbeans for Mobile App

Netbeans IDE provides the following components that make it easy to create mobile applications or games:

Netbeans IDE

Create, test and debug applications for the Mobile Information Device Profile (MIDP) 1.0, 2.0, 2.1 (MSA), the Connected Limited Device Configuration (CLDC) 1.0 and 1.1, and the Connected Device Configuration (CDC).

The NetBeans IDE comes bundled with the latest Java ME SDK 3.0 which supports both CLDC and CDC development. You can register other mobile and embedded platforms from the Tools menu.

Visual Mobile Designer

Develop GUIs rapidly with the Visual Mobile Designer (VMD): Drag and drop components like wait screens, login screens, file browsers, an SMS composer, and splash screens are included. The Analyzer tool helps you decrease file size by identifying unused components for removal, and it also checks for MIDP 1.0 compliance. The VMD also makes GUI localization easier.

SVG Component Palette

Select basic shapes from the SVG image palette to get started and use the other SVG components in the palette such as SVGForm, Button, CheckBox, TextField, Slider, and more to create rich content interfaces for your mobile applications.

Data Binding

Data Binding to UI components is a simple and consistent way for applications to interact with and display data using the Data Binding property editor together with the DataSet component in the Visual Mobile Designer.

Mobile Game Builder

Develop mobile games with a visual editor designed for the MIDP 2.0 Game API. The API allows you to create game scenes with sprites on a game canvas using tiled layers and layer management.

Next, we shall only cover the basic Netbeans IDE interface. The other topics shall be covered later on.

Lab 01: My First MIDlet for Java ME Application

Step 1: Start Netbeans 6.9.x

Step 2: Create a new Java ME MIDP application:

File > New Project

image005

Project name: HelloWorld1

image008

Netbeans IDE navigations

[Projects] [Navigator] [File]

image016

Views: Source Screen Flow Analyzer

Other windows: Properties Palette

image017

Visual Mobile Designer Palatte Reference:

http://wiki.netbeans.org/VisualMobileDesignerPalatteReference

Step 3: Build and Run: Run > Run Main Project (F6)

image018

image019

Step 4: Select another emulator phone: Projects Window: right click on HelloWorld1 > Properties

Click on the Devices to select another emulator phone.

image023image024

Step 5: Build and Run: Run > Run Main Project (F6)

Lab 02: Packaging and Deployment

Step 1: Run > Clean and Build Project (shift F11)

Step 2: Browse using Windows File Explorer to the project folder

For example: …\ My Documents\NetBeansProjects\HelloWorld1\dist

image025

Step 3: Direct PC connection (depends on your mobile phone)

For Sony Ericson, copy the above two files into the "installs" folder

image026

Step 4: In your mobile phone, browse to the "installs" folder to install the MIDlet

What do we need to know?

(1) Automatic preverification

Because J2ME is designed for small devices with limited memory, much of the usual Java preverification has been removed from the virtual machine to allow for a smaller footprint. As a result, it is necessary to preverify your J2ME application before deployment. An additional check is made at run time to make sure that the class has not changed since preverification.

In Java ME IDEs (Netbeans/Eclipse), preverification of classes is done automatically during the compile process.

(2) Deployment: JAD and JAR files

JAR file is just a zip file containing two files: MANIFEST.MF and preverified class file (HelloMIDlet.class)

MANIFEST.MF is a text file containing the following information:

Manifest-Version: 1.0

Ant-Version: Apache Ant 1.8.1

Created-By: 1.6.0_16-b01 (Sun Microsystems Inc.)

MIDlet-1: HelloMIDlet, , hello.HelloMIDlet

MIDlet-Vendor: Vendor

MIDlet-Name: HelloWorld1

MIDlet-Version: 1.0

MicroEdition-Configuration: CLDC-1.1

MicroEdition-Profile: MIDP-2.1

JAD (Java Application Descriptor) is just a text file containing the following information:

MIDlet-1: HelloMIDlet, , hello.HelloMIDlet

MIDlet-Jar-Size: 2069

MIDlet-Jar-URL: HelloWorld1.jar

MIDlet-Name: HelloWorld1

MIDlet-Vendor: Vendor

MIDlet-Version: 1.0

MicroEdition-Configuration: CLDC-1.1

MicroEdition-Profile: MIDP-2.1

(3) Other Deployment methods

Over-The-Air (OTA)

image027

Email and MMS

A JAR file could be included as an attachment to an e-mail or within an MMS. When the e-mail/MMS is opened, the AMS will automatically be activated and provide an option to install the sent MIDlet.

Deploying from Netbeans

Projects [Right click] select Properties, select Deploying, select Deployment Method:

image028

Projects [Right click] select Deploy

That’s all for the introduction. Happy learning ....

Continue your learning via tutorial series to develop mobile games in Java ME using Netbeans: http://mpgddmgd.blogspot.com/

1 comments:

Mobile Application Development said...

Thanks for sharing nice information about mobile application development. Mobile Application Development for iPhone development and Android Mobile Application Development. Awesome post.