Working with J2ME, NetBeans, NetBeans Mobility Pack, J2mePolish and BlackBerry is not an easy task for sure. After spending nights I've managed to put up a workable development environment "that works". For all those out there, who are working on the same or planning to work in near future, following is a step by step procedure which will be helpful in setting up things quickly.
Pre-Requisites:
- NetBeans 5.5
- Download: http://www.netbeans.info/downloads/index.php?rs=11
- Installation Instructions: http://www.netbeans.org/community/releases/55/install.html
- NetBeans Mobility Pack for CLDC
- Download: http://www.netbeans.info/downloads/index.php?p=4
- Installation Instructions: http://www.netbeans.org/community/releases/55/1/mobility-install.html
- J2mePolish 2.0 RC4
- Download: http://www.j2mepolish.org/download.html
- Installation Instructions: http://www.j2mepolish.org/docs/install.html
- BlackBerry JDE 4.2.1
- Download: https://www.blackberry.com/CorpDevZone/sd2integration.do?file=https://www.blackberry.com/Downloads/contactFormPreload.do?code=00EC53C4682D36F5C4359F4AE7BD7BA1&dl=082B317A6A9BDCF567A66673A23C2763
- NOTE: You need to sign in to download (Sign up is Free)
- Installation Instructions: Follow the installation wizard instructions.
- BlackBerry Email and MDS Services Simulator
- Download: https://www.blackberry.com/CorpDevZone/sd2integration.do?file=https://www.blackberry.com/Downloads/contactFormPreload.do?code=00EC53C4682D36F5C4359F4AE7BD7BA1&dl=A863E2C10B7E517A09C80F83418E8B2D
- NOTE: You need to sign in to download (Sign up is Free)
- Installation Instructions: Follow the installation wizard instructions.
Configuration:
- Adding BlackBerry JDE 4.2.1 as a Custom Emulator:
- Open NetBeans IDE
- Select Tools > Java Platform Manager
- Click the Add Platform button
- Select Custom Java Micro Edition Platform Emulator. Click Next.
- Browse BlackBerry JDE 4.2.1 installation directory (C:\Program Files\Research In Motion\BlackBerry JDE 4.2.1)
- Enter desired Platform Name (RIM BlackBerry JDE 4.2.1)
- Enter desired Device Name (8800)
- Keep the Preverify command as it is
- Modify Execution and Debugger command as follows:
- Execution Command:
cmd /C "cd /D {platformhome}{/}simulator&{device}" - Debugger Command:
cmd /C "cd /D {platformhome}{/}bin&jdwp"
- Execution Command:
- Click Next
- Select all listed files except net_rim_api.jar and click Remove.
- Click Next.
- Click the Add button next to JavaDoc panel and browse to /docs/api folder inside the BlackBerry JDE Installation directory (C:\Program Files\Research In Motion\BlackBerry JDE 4.2.1\docs\api)
- Click Finish and then click Close.
Creating a New Project:
- Select File > New Project
- Click Next
- Enter Project Name, select Project Location and click Next
- Select desired Configurations, Profiles/Platforms, Libraries and Devices. Click Next.
- Leave Specify Project Properties panel as it is and click Next.
- Click on the Files tab and create /dist and /source/src folders under the project root folder.
- Click on the Projects tab, then right click on TestProject and select New > Java Package
- From the Projects tab, right click on newly created test package and select New > Midlet
- Enter desired Midlet Name, Midlet Class Name and select Package. Click Finish.
- From the Projects tab, right click on TestProject and select Properties.
- From the Category list, click on Platform, select BlackBerry JDE 4.2.1 from the Emulator Platform drop down list and select Ok.
- From the Category list, select MIDlets under Application Descriptor and make sure TestMidlet entry is there.
- From the Category list, select Libraries & Resources and make sure enough-j2mepolish-client.jar is there with its correct path. For example, C:\Program Files\J2ME-Polish\import\enough-j2mepolish-client.jar. You may witness incorrect path like C:\Program Files\J2ME-Polish\import\C:\Program Files\J2ME-Polish\import\enough-j2mepolish-client.jar
- Click Ok.
- From the Files tab, double click on build.xml to open it in editor.
- Enter two new properties blackberry.home and polish.blackberry.verbose in the build.xml file as show below:
- Update general settings to match your desired settings
- Set your desired Device Requirement
- Remove /base from resources and root dir paths. Also comment out ProGuard obfuscator.
- For testing purpose, write code to connect to http://www.google.com/ and then print the google’s home page’s html on the debugger console.
Click here to download TestMidlet.java - Run the BlackBerry MDS Simulator, a console window will open, minimize it and do not close it during development and testing.
- Run the JDWP module i.e. the BlackBerry debugger
- Now, from the Projects tab in the NetBeans IDE, right click on the TestProject node and select Debug Project.
- You will notice activities in the debug window and then debug console. Finally, the BlackBerry emulator will start; it will then try to connect to the debugger and then display the blackberry menu.
- Click on the console icon named “Blank” and then watch the JDWP’s debugger console, which shows all activities and console logs. You will notice that Google’s home page’s html is printed on the console.
- Finish.
Great step-by-step tutorial. I wanted to dabble with a similar configuration but gave up after a couple of days of off again, on again, monkey around with the setting to try and get it all working. It's sure a pain in the rear and certainly shouldn't be this hard. I'm still not sure after all this time why what I consider to be very basic and simple task are not just that.
ReplyDeleteKeep the post coming if you build anything interesting or discover any tip, tricks, or solid information.
Keep your spirit.... Thank you.
ReplyDeleteExcellent article!! Thanks much!
ReplyDeleteWe are developing a mobile application for our client and one their requirements is to get a single build for all mobile phones like Migg33 (http://www.mig33.com/)
I am planning to go the Netbeans + Mobility + J2MEPolish way, but yet not quite sure about the feasibility. I would ike to hear some comments from the J2ME gurus before I proceed.
Thanks
Mick
Thanks, it is a really good article.
ReplyDeleteI followed step by step and everything goes well, however the .jar file that results from the Build is so big (720KB).
Do you think I need to change something in the build.xml polish file?
Thanks,
Diego A.
Mick, Polish doesn't always integrate into NetBeans successfully. If you click my name there I've got some fixes for the two main bugs people run into.
ReplyDeleteIf you get it working Polish is good, but check out the SVG graphic designer on NetBeans 6.1. It will be easier to setup as its built in, but you need to check if your target devices support the SVG API.
great article!!!
ReplyDeletethnX a lot for giving such good step by step integration
Hey bro nice tutorial....... but i need some of urhelp regarding GUI part for my j2me application. i have completed all the flow work and test the apps in phones... all left is gui for which i m totaly new. so could u help me to get this one right.
ReplyDeleteusing:
Netbeans.
IT WAS REALY HELPFULL FOR THE SETTING REQUIRED, CAN U POST SETTING USING ECLIPSE RUTHER THATN NETBEANS
ReplyDeleteTHANKS......
Humayun, Thank you very much for this sharing. But when i meet this error: 'Unable to preverify for device [BlackBerry/8100]: java.io.IOException: Cannot run program "preverify.exe": CreateProcess error=2, The system cannot find the file specified'
ReplyDeleteHelp me please !
bachnv88@gmail.com
Hi Author
ReplyDeleteThanks for make this informative post.
Keep Sharing