Thursday, January 05, 2006

Modern mobile phones provide number of advanced functions, among which possibility of running mobile applications seems to be the most interesting feature. It changes a standard mobile phone into a mini-size yet still powerful computer able to run various applications. Available mobile applications range from games or and organizer type of applications to advanced business applications designed for company’s portable employees. Moreover, the number of mobile application developers is rapidly growing and year by year the developed applications are better, faster and more innovative. However in difference to international trend, the technology of Symbian OS and J2ME development is very far from being popular in Indonesian. It is extremely difficult to find local application developers experienced in J2ME and unfortunately mobile application development industry is almost unexisting here. In a hope of creating more interest in the area of mobile application development within Indonesian application developer community, I prepared a series of articles on J2ME development articles. In this first part of the series of articles, I introduce the very basis of mobile application development, which is setting-up mobile application development environment on your workstation.

Mobile applications for Symbian OS based mobile phones can be developed in various programming languages. The most popular programming language on mobile phones is definitely Java. This programming language named after a cup of Javanese coffee, provides simple but truly powerful mean of building portable applications. The great popularity of Java on mobile phones comes mostly from the wide support of major mobile phone manufacturers for the J2ME (Java 2 Mobile Edition) applications and great support by major corporations such as Sun Microsystems and Nokia. Furthermor, the overall idea of Java multi-platform compatibility makes it a perfect choice for portable devices such as mobile phones.

One of the leading Java development tools on the market is NetBeans product. In June 2000 NetBeans was generously made open source by Sun Microsystems, which still remains the project sponsor. NetBeans is an open-source project that liberated mobile application development and provided strong alternative to commercial mobile application development enviroments. It allowed to replace a complicated process of configuring development environment that discouraged number of users from trying development of J2ME applications, into a simple, trivial to install and powerful mobile application development tool. What previously took hours now takes minutes and provides excellent comfort for developers. The NetBeans project is also a community where people from just about any country, have the ability to make a wide variety of contributions and exchange their knowledge.

The two base NetBeans products are NetBeans IDE and NetBeans Platform. Thanks to Sun Microsystems, both products are free for commercial and noncommercial use, which makes it an excellent tool for beginners in a mobile application development. For this reason I decided to focus my article on the use of NetBeans IDE application. Since NetBeans is free, you can start developing applications from now without any adiditonal cost, and if you are commited you can even make profit out of it!

Let’s start

The first stage of mobile application development is getting all the necessary applications. As previously mentioned everything we need can be freely downloaded from the Internet. The list of basic elements of our application development enviroment goes as follow:

  • J2SE(TM) Development Kit,
  • NetBeans IDE,
  • NetBeans Mobility Pack Installer.
The first element of our development environment is the Java 2 Platform Standard Edition (J2SE) Java Development Kit, shortly called J2SE JDK. It is the premier platform from Sun Microsystems for rapidly developing and deploying secure, portable applications. It is a basis of our application development environment and the required file can be downloaded from here.

The file we need is listed under title J2SE(TM) Development Kit 5.0 Update 6 - JDK 5.0 Update 6 - the most recent version at the moment - (file name: jdk-1_5_0_06-windows-i586-p.exe) which is 59.86 MB in size. Certainly, versions for other OS, such as Linux or Solaris are also available.

The second element we need is NetBeans IDE, which can be downloaded from here. At the moment, the current stable version is NetBeans IDE 4.1 and we advise to use this one, before the version 5 becomes stable. The required file is named netbeans-4_1-windows.exe and is 46.43 MB in size. The Linux, Solaris OS and Mac OS X are also supported. Note that it is also possible to get the NetBeans IDE and J2SE JDK together in a bundle installation through previously listed java.sun.com web-site, yet the size of such package is above 90MB.

The third and final element is NetBeans Mobility Pack that provides mobile application development functionality for NetBeans. It can also be downloaded from NetBeans site. The file name is netbeans-4_1-platform.zip, size 4.41 MB.

Total list of required installation files (for Windows environment) is as follow:
  • jdk-1_5_0_06-windows-i586-p.exe,
  • netbeans-4_1-windows.exe,
  • netbeans_mobility-4_1-win.exe,
The installation of the packages should be in the same order as listed above. First J2SE JDK, next NetBeans IDE and finally NetBeans Mobility Pack.

After this simple installation process, we can run NetBeans IDE and start development of our first mobile application [Figure 1].
Figure 1. NetBeans IDE Initial Screen.
The first recommended thing to do after installing NetBeans is to try one of the sample projects. The applications listed in Samples/Mobile/MIDP 2.0 Samples/* demonstrate the advanced abilities of mobile applications. For instance 3D Graphics Example demonstrates the use of 3D graphics on mobile, which is quite impressive. To see it yourself simply open this sample project and after opening, from the menu chose Run -> Run Main Project or simply press F6. The project will be run in the emulator looking precisely like a mobile phone. If we click right button (just next to the SELECT button in the middle of the phone) we will start one of the provided applications. My favourite example is PogoRoo, which will show 3D animated jumping kangaroo that can be controlled via mobile-phone control buttons! [Figure 2].
Figure 2. PogoRoo Sample J2ME game.
Now, as a beginner J2ME game developer, you could simply modify the game code (example.pogoroo/PogoRooMIDlet.java/PogoRooMIDlet/* in the left-top corner box of NetBeans IDE) and try to modify the code. For instance if you modify the "private void turnRoo()part" of the code, you can change the way the kangaroo will turn after pressing phone control keys.

Now, in order to see the application working on your mobile phone, you need to “Build” it into package that can be transferred to the mobile-phone - simplest option is .jar. To Build application simply click F11 in NetBeans, which will generate file 3DGraphicsExample.jar that can be transferred to your mobile phone. However, there are some important settings to configure such as choice of device profile (MIDP-1.0 or MIDP-2.0) and choice CLDC. Yet, this is subject for the next part of the article series.

Conclusion

I hope this short article proven that starting mobile application development is rather simple process and everyone with basic programming knowledge can start developing mobile phone games or various other portable applications. This can be both great fun and great business, as mobile applications are getting increasingly popular making application development a very profitable business.

PS: This text was recently published in Tabloid Pulsa with my permission.

5 comments:

Anonymous said...

Nice article, thank's for the info ( from a J2ME newbie )

Greger

Anonymous said...

Thanks alot
I never thought, it would be that simple to do a mobile application and embed into to mobile. In next article, please, give how exactly I can load my own game into my moblie phone and Use that

Marek Bialoglowy said...

Please be patient everyone. I'll release Part 2 of the article, explaining creation of a new project on Friday (13.01.2006), still need to add some comments to the source and verify the text. Many thanks for interest in my article.

Marek Bialoglowy said...

Part 2 is published.

Anonymous said...

really great sir , thanks for the information . iam a j2ee developer , i never thought that there could be such an article about j2me which simplifies everything . rite now iam with a j2me project , while surfing with google . i found yours .. once again thanks .....

web statistics