You Are Here:

Community: Wiki

This page was last modified on 3 June 2009, at 12:49.

Creating your first MIDlet using EclipseME

From Forum Nokia Wiki

These instructions assume you've installed Java ME development tools according to article Installing Java ME development tools for S60.


Contents

Create a new project

  1. Start Eclipse, and go to the workbench. (If you are unaware of Eclipse concepts such as the "workbench", now is a good time to use the Help function to learn the basics.)
  2. Select the menu item File | New | Project.
  3. Expand node J2ME and select J2ME Midlet Suite. Press Next.
  4. Give the project name HelloWorld. You can also change the workspace location to be different from the default. Press Next.
  5. Select Sun Java(TM) Wireless Toolkit 2.5.2 for CLDC and DefaultColorPhone. (Selecting S60 3rd Edition FP2 SDK for MIDP and S60Device will cause running the MIDlet to fail, with an dialog displayed, saying that the Jar file could not be initialized because of a caught exception.) Press Next.
  6. In tab Source, check the checkbox Allow output folders for source folders, and accept the default.
  7. Press Finish.

Eclipse's package explorer should show a newly created project HelloWorld, which includes folders src and res, library J2ME library, and JAD file HelloWorld.jad.

Create a new MIDlet

  1. Select the menu item File | New | Other.
  2. Expand node J2ME and select J2ME Midlet. Press Next.
  3. A dialog with the title J2ME Midlet appears.
    • The Source folder setting item should already be set to <your workspace location>/src.
    • For the Package setting item, give the name com.example.helloworld.
    • For the Name setting item, give the name HelloWorldMidlet.
    • Press Finish.

You should now see a newly created file HelloWorldMidlet.java in Eclipse's editor window, with some skeleton code. Eclipse's package explorer should show that it has been created under HelloWorld/src/com.example.helloworld.


Write MIDlet code

Replace the code of HelloWorldMidlet.java with the code from article Hello World in Java ME.


Debug MIDlet code

  1. Set a breakpoint at the start of method startApp.
  2. In the Package Explorer, right-click on HelloWorldMidlet.java, select Debug As, and then Emulated J2ME Midlet.
  3. A dialog comes up asking if you want to switch to the Debug perspective. Press Yes.
  4. The phone emulator window should now be displayed. Eclipse should have switched to the Debug perspective, and in the editor window, the execution of the MIDlet should have stopped at the breakpoint you set.
  5. Resume execution. The emulator's screen should now display "Hello Hello World!"


Create a deployment package

  1. In the Package Explorer, right-click on project HelloWorld, and select J2ME | Create package or J2ME | Create Obfuscated Package.
  2. A directory HelloWorld/deployed should have been created, containing the files HelloWorld.jad and HelloWorld.jar.


See also


External links

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fTalkE3aE4cargeE5fscreenE5fsaverX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ
User Rating: qfnZuserE5FratingQNx5E2E0000X