×
Namespaces

Variants
Actions
Revision as of 23:52, 7 June 2007 by giaperrucci (Talk | contribs)

NetBeans

From Nokia Developer Wiki
Jump to: navigation, search

NetBeans is an integrated development environment (IDE) developed using the NetBeans Platform. It also refers to a platform for the development of Java desktop applications.

The NetBeans IDE is an open-source integrated development environment written entirely in Java using the NetBeans Platform. NetBeans IDE supports development of all Java application types (Java SE, web, EJB and Java ME mobile applications). Among other features are an Ant-based project system, version control and refactoring.

For mobile development it has the free Mobility Pack plugin that many Rapid Application Development (RAD) features included, as a Visual Form Designer or multitarget developent. It also has an automatic connection to many Nokia and other platforms emulators and SDKs.

Another plugin, in beta, UML for NetBeans (http://uml.netbeans.org) allows developer to design UML diagrams, as Class Diagrams and synchronize code with them.

Some features for Java developing are:

  • Code completion
  • Javadoc Help
  • Many Refactoring features
  • Code Assistant
  • Project View
  • Many tools and plugins availables

Last version is 5.5 and can be downloaded from http://www.netbeans.info/downloads/index.php


Contents

Creating a new CLDC project with Netbeans

A project contains information about programs files and IDE environment settings. To create a new project click on File->New Project… (Ctrl+Shift+N). Then a window like the one in the Figure below appears:


Netbeans1.png


After choosing Mobile Application, click on “next” button. The window shown in the Figure below pops up and information about the project name and its location on the file system are required to be inserted.


Netbeans2.png


By clicking on “Next” another window shows up and the Emulator Platform can be chosen if other third-party emulators are installed. Otherwise the default J2ME Wireless toolkit 2.2 is used. Moreover the device configuration and profile can be set to better emulate the target device. See Figure below:


Netbeans3.png


By pressing the “Finish” button, the new project creation is done. Next step is to add MIDlets and all the other classes needed by the application to the project.


Creating a new Midlet

The MIDlet class is the core of the application. The steps for creating a new MIDlet class are shown below. By right clicking on the “<default package>”->New->MIDlet… in the Project tab a new window appears, as the one shown in the figures below:


Netbeans4.png


Netbeans5.png


After you have inserted all the information about the class name and you have clicked on “Finish” button, the main window of NetBeans displays the skeleton of the HelloWorld MIDlet as shown in the Figure below:


Netbeans6.png


Now you can insert the lines of code you need for your application.


Building the project

After having inserted the code in the HelloWorld.java file and saved the project by pressing File->Save (Ctrl+S), the project is ready to be built. Click on Build->Build Main Project (F11) and NetBeans will start to compile the project, as shown in the Figure below. In the Output window, information about the building process are displayed.


Netbeans7.png


If no errors occur, you can run the project to start the emulator by clicking on Run->Run Main Project (F6), as shown in the Figure below:


Netbeans8.png


The emulator pops up on the screen and you can launch the application now by clicking on the right soft button on the phone emulator. The application is now running on the emulator and on the screen of the phone you can see the “Hello World” message as shown in the Figure below.


Netbeans9.png


Before you start developing an application you may have to decide which device your application is target for. It will help you to choose the proper emulator to use. To this purpose NetBeans can integrate other third-party emulators which look like real devices on the market. In fact the screen size and graphical interface of the default Wireless Toolkit emulator do not look like a specific mobile phone.

MIDlet on the phone

When the project is built, NetBeans creates the MIDlet Suite for the project. In the HelloWorld/dist folder two new files are created: HelloWorld.jad and Helloworld.jar as shown in the Figure below. The latter one is the archive that contains all the files needed by the application to work. Therefore, for installing the MIDlet on the phone, this file needs to be transferred to it. There are two ways of sending the application on a real device for installing it:

- Using the software that the vendor of the handset provides, such as Nokia PC Suite software ([[1]]) for Nokia phones. - Using Infrared or Bluetooth technology

As soon as the .jar file is sent to the phone, the installation process starts by clicking on the received file.


Netbeans11.png

310 page views in the last 30 days.
×