howto: first mobile application in Netbeans

Today I’ll show how to create new mobile app project using Java Mobile and Netbeans (if you don’t have Netbeans installed, read my recent post). If you have installed IDE properly, you should see this screen:
To start new project click:Next, choose options responding to what kind of project you want to create. Select “Java ME” and “Mobile Application”Now, choose project name and path. Also you need to select options “Set as Main Project” (about it later), and “Create HelloMIDlet” which is responsible for creating default MIDlet (Java Mobile application for mobile phone). You can see, that project folder has been set automatically.
On the next screen don’t change options “Emulator Platform” and “Device”. It is important to change device configuration and profile. Change CLDC to 1.0 and MIDP to 2.0 (see image). It will let us to run app on much greater number of phones (this issue was covered in earlier posts).Don’t change anything on next screen and press “Finish”.

Congratulations! You have just created your first mobile app project, automaticaly thanks to option “Create HelloMIDlet” Hello midlet was created ­čÖé and it’s ready to run and be copied on mobile phone.

IDE look after clicking “Finish”: Now, you can jump beetween code vieves by using thoose buttons.

  • Source lets you edit source code.
  • Screen lets you edit application view in easy-to-use interface. I don’t recommend this method. Of course it’s very easy in the beginning, but later, if you have to do some tiny modyfication, you’ll need to use it again – code created by this editor cannot be modified in “Source” tab. It’s easier in the beginning as I said, but after gaining some experience you’ll find everything easier to do in “Source” tab.
  • Flow is used to project, edit, view, or set relationships beetween application’s screens.
  • Analyzer – let’s leave this for later.

Becouse during creating project we have set option “Set as main project”, now we can only click button marked on screenshot (or use shortcut F9) to build and run our project.

Now we can “play” with our program in emulator window. Files ready to upload on your mobile are located in:

D:javaHellodist

in my case, and generally:

[project location] / [project name] /dist/ [filename].jad and .jar

filename is by default set to project name.

I would like to encourage you to experiment with this app and IDE’s options. Soon I’m going to post information on how to edit options in JAD file (this file is read by telephone to set information about program, like name, vendor, version).