需要:
jdk,wtk就不用說了.
下載j2mepolish :http://www.j2mepolish.org/downloads/J2MEpolish-1.2.4.Html#download
直接雙擊jar文件(Java -jar J2MEpolish-1.2.4.jar)根據向導安裝即可,很簡略.
在eclipse中運行samples裡面的menu例子.
拷貝 ${polish.home}/samepse/menu到eclipse的工作目錄.
然後建立一個Java工程名為 menu (會主動導進拷過來的menu裡面的src,res等等)
直接ant運行build腳本即可天生jar,jad文件(會發明有許多版本,不同語言,不同平台,不同midp版本的)
要配置天生哪些版本,或者平台的jar,jad,可以在build.XML裡面配置,如下地位:
語言(默認有德文和英文)可以在如下地位配置:(我把德文改稱了中文)
dir="resources"
defaultexcludes="yes"
excludes="readme.txt"
>
留心,假如配置了一個cn的話,要在resources裡面添加一個messages_cn.txt
內容可以如下:
#######################################
# #
# This file contains translations #
# of the application. #
# Key and Value are separated #
# by the equals-sign "=". #
# #
#######################################
# You can also define localized preprocessing variables here, by starting the
# definition with "var:". Variables defined here will override the ones defined
# in the -section of your build.XML.
# Variables starting with "polish." or "MIDlet-" don't need to start with "var:"
# by the way.
var:MyExampleVariable=你好,midlet
var:GameName=測試
# Setting J2ME Polish variables:
polish.command.ok=確認
polish.command.cancel=取消
polish.command.select=選擇
polish.command.options=選項
# It's also possible to set MIDlet-attributes for your JAD- and MANIFEST-files here.
# If you like you can start them with "var:" as well, but it is not needed.
# Again MIDlet-attributes defined override the one defined in the -
# and -sections of your build.XML
MIDlet-Description=中文哦
MIDlet-Name=J2ME Polish BeispIEl
MIDlet-Delete-Confirm=J2ME Polish
# Setting appplication specific translations:
cmd.StartGame=${GameName} 開端
cmd.Quit=退出
cmd.ShowLog=log 顯示
menu.StartGame=${GameName} 開端!
menu.LoadGame=${GameName} 讀取
menu.Highscore=最高分
menu.Quit=退出
#menu.go=出發
messages.welcome=歡迎阿, {0}!!!
=========================================
這個時候在dist目錄下天生了中文的不同平台和midp版本的jad,jar文件
用模仿器運行即可看到後果
假如要在ant的時候就打開模仿器運行,修正一下build.XML的如下處所:
//改為true
配置模仿器的處所:(不需要修正,我修正是不想看到內存和網絡監督的那些東西)
wait="true"
trace="class"
securityDomain="trusted"
enableProfiler="false" //默認true的,我改稱了false
enableMemoryMonitor="false" //默認true的,我改稱了false
enableNetworkMonitor="false" //默認true的,我改稱了false
if="test"
>