J2ME入門程序--第一個HELLOWORLD手機程序

         <!-- /* Font Definitions */ @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0; mso-font-charset:2; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face {font-family:宋體; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-alt:SimSun; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} @font-face {font-family:"/@宋體"; panose-1:2 1 6 0 3 1 1 1 1 1; mso-font-charset:134; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; text-align:justify; text-justify:inter-ideograph; mso-pagination:none; font-size:10.5pt; mso-bidi-font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:宋體; mso-font-kerning:1.0pt;} a:link, span.MsoHyperlink {color:blue; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline; text-underline:single;} /* Page Definitions */ @page {mso-page-border-surround-header:no; mso-page-border-surround-footer:no;} @page Section1 {size:612.0pt 792.0pt; margin:72.0pt 90.0pt 72.0pt 90.0pt; mso-header-margin:36.0pt; mso-footer-margin:36.0pt; mso-paper-source:0;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:1654017541; mso-list-type:hybrid; mso-list-template-ids:-2120340816 21917624 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @list l0:level1 {mso-level-text:"/(%1)"; mso-level-tab-stop:36.0pt; mso-level-number-position:left; text-indent:-36.0pt;} ol {margin-bottom:0cm;} ul {margin-bottom:0cm;} -->

主要是開發環境的配置和運行時的一點點注意事項:

第一:安裝環境需要。

(1 JDK ( 我用的是 jdk-1_6_0_12-windows-i586-p.exe) 高於這個亦可。 ' E% _: `% ]$ M$ R! p. q# `
    
功能:開發 java 程序必備。
) s9 [4 z6 V# ~! B/ g9 ldev.chinamobile.com
5 E( ^1 D1 F4 ^  }# g (2)WTK (Wireless Toolkit 2.5.2)
當前最新版本 2.5.2
. Z4 j# y1 |* ^, /
開發者社區論壇       功能: Eclipse j2me 調試設備,需要用到 WTK 中的設備。 dev.chinamobile.com0 W# W5 w3 `2 ^7 b
     
下載地址: http://java.sun.com/products/sjwtoolkit/zh_download-2_5_2.html

說明:這個也是爲了開發方便,就相當於一個應用平臺,可以開發程序直接放到這裏面運行是同樣的效果。
2 z4 U6 c5 K, b  t! I  I9 l& k
開發者社區論壇 " u0 Q# m" [' O5 z$ A
(3)Eclipse
,任意新版本都可,我用的是 3.5 英文版。 開發者社區論壇 4 r0 k0 @- A5 l- j- z7 m
     
功能:開發 IDE dev.chinamobile.com4 z9 ^. t+ O! J" L; V! T
   
下載地址: http://www.eclipse.org/downloads ... e-SDK-3.5-win32.zip 中國移動開發者社區 ! q, m, ~  A% W% b% T2 q7 W& D1 @! C
     
該版本爲 Eclipse Classic 3.5.0 (162 MB) 版本 dev.chinamobile.com* i( Y$ @5 Z5 F( {/ f0 C0 O$ E8 n

  K* e5 G4 C( R5 [ (4)eclipseme 1.7.9
6 O. ?6 [# ~! T
中國移動開發者社區     Eclipse 中應對與 j2me 的插件,可以簡單方便的完成 j2me 的開發。 . Z6 x9 U8 ?4 Y, N" _; P, p1 x
   
下載地址: http://sourceforge.net/projects/eclipseme/files/
4 {  ~* h3 ?  k5 n* S5 U1 a      
點擊其中的相應文件即可。

 

前面三個的安裝一路下去就 OK 了,只有最後一個插件就在 Eclipse 當中安裝就可以了。這也很簡單。具體的安裝如: HELP à INSTALL NEW SOFTWARE à 然後選擇 eclipseme 1.7.9 文件就可以了。很簡單吧,這裏只有 JDK 需要配置環境變量就可以。

 

第二:配置 Eclipse

(1)           配置集成: Window à preferences à 有個 J2ME ,然後選中, à 選第一項( Device Management à import à 路徑就選擇你的 WTK 的安裝路徑, OK 了,

(2)           然後就是 NEW 一個 J2ME 工程了,網上一大堆。這個隨便找都是,隨便直接 new 都能夠建立一個,直接就可以運行了。

(3)           程序見下:

(4)           然後就是運行 —> 點擊 run 下拉列表 à 選擇左面的 Wireless ToolKit Emulate 下面的要運行的工程,比如這裏的 hello—> 主要是右面要選中 Midlet 按鈕,然後選擇你的 Hello 程序就可以了,哈哈,這裏你輸入一個 H 他就會出現的, 很簡單吧,然後就有了,不會出現網上說的那些問題。

 

程序很簡單,用 Eclipse 可以自動生成。其他開發工具也不復雜。

   

發佈了67 篇原創文章 · 獲贊 7 · 訪問量 25萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章