Download
j2me programming n.
Skip this Video
Loading SlideShow in 5 Seconds..
J2ME Programming PowerPoint Presentation
Download Presentation
J2ME Programming

J2ME Programming

342 Vues Download Presentation
Télécharger la présentation

J2ME Programming

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. J2ME Programming

  2. Recommended Books • Programming Wireless Devices with the Java2 Platform, Micro Second Edition (Paperback)by Roger Riggs (Editor), Antero Taivalsaari, Jyri Huopaniemi, Mark Patel, James VanPeursem, Aleksi Uotila • Wireless J2ME Platform Programming (Paperback)by Vartan Piroumian

  3. Download J2SE 1.4.2 SDK: • To compile and run java, we firstly need to download the standard development kit (SDK) for J2SE (Java 2 Platform Standard Edition). The latest version of J2SE is 1.4.2. • To download, visit: http://java.sun.com/j2se/1.4.2/download.html, then • 1. Click "Download J2SE SDK"; • 2. Select "Windows Offline Installation, Multi-language"; • 3. Execute the file "j2sdk-1_4_2_06-windows-i586-p.exe" to install.

  4. Download J2ME Wireless Toolkit 1.0.4: • Now, you can use Textpad to write J2SE programs. However, our goal is to write Java 2 Platform Standard Edition (J2ME) programs for mobile phones. Originally, you have to download CLDC 1.1 and MIDP 2.0 for developing J2ME programs for mobile phones. Now, you can simply download J2ME Wireless Toolkit 2.2 which includes CLDC 1.1, MIDP 2.0 and interfaces to compile and run J2ME program. • To download J2ME Wireless Toolkit 2.2, visit: http://java.sun.com/products/j2mewtoolkit/download-2_2.html, then • 1. Click "Download" at the bottom of the page. • 2. Accept "Licence Agreement". • 3. Select "Windows Platform" to download. • 4. Execute the file "j2me_wireless_toolkit-2_2-windows.exe" to install.

  5. Run Sample Program for J2ME. • Now you can run sample J2ME programs. The steps are as follows: • 1. Launch the "ktoolbar" in the J2ME Wireless Toolkit. • 2. Click "Open Project". • 3. Select a Project to open (says “Demos"). • 4. Click "Run".

  6. Run "HelloWorld" Console Program for J2ME • In order to develop your own Program, you should know how to create a new Project using "ktoolbar". The steps to create a very simple project for a “Basics1" program is a follows: • 1. Launch the "ktoolbar" in the J2ME Wireless Toolkit. • 2. Click "New Project". • 3. Type "Basics1" in both text boxes for "Project Name" and "Midlet Class Name". • 4. Click "Create Project" and click "OK".

  7. Run "HelloWorld" Console Program for J2ME (Cont.) • 5. You can see a sentence saying that the location of "Java source files". • 6. Download the file "Basics1.java" and save to that location (something like "C:\WTK22\apps\Basics1\src"). • 7. Click "Build" to compile. • 8. Click "Run" to execute the program. • You will see the string "Hello World!" in the console after you click the "Launch" button in the mobile phone

  8. .

  9. Run "HelloWorld" Application Program for J2ME • Let's jump right in the water by creating a new project. Click on New Project in the button bar. The toolkit prompts you for a project name and the name of a MIDlet class in the project. Fill in HelloSuite and HelloMIDlet as shown below • Once you fill in the project name and first MIDlet name, the toolkit gives you a chance to edit the project settings. Just accept the defaults for now; press OK to finish creating the new project. In the text output pane of the J2ME Wireless Toolkit, you'll see several helpful messages telling you where to store the project's source files. On my machine, these messages are:

  10. Creating project "HelloSuite" Place Java source files in "C:\WTK22\apps\HelloSuite\src" Place Application resource files in "C:\WTK22\apps\HelloSuite\res" Place Application library files in "C:\WTK22\apps\HelloSuite\lib" The toolkit stores each project in a subdirectory of the appsdirectory. • The name of the subdirectory is the same as the name of the project. Here, the toolkit has created a new directory, c:\WTK22\apps\HelloSuite. Each project subdirectory has a standard structure: