提交給移動上線的kjava游戲,如果直接用jb打包會遇到平台api 問題。
現在我們可以用ant打包來解決移動平台api問題。具體方法如下:
1.下載antenna-bin-0.9.13.jar,apache-ant-1.6.2
2.把antenna-bin-0.9.13.jar放到apache-ant-1.6.2lib下,
3.把nokiaui.jar放到apache-ant-1.6.2lib下,
4.把gx.jar放到apache-ant-1.6.2lib下,
5.設置ant的環境變量:有ANT_HOME,PATH兩項
6.編寫bulid.xml
7.打包後在bulid.xml的同一目錄下有一個MANIFEST.MF這個文件,可以把這個放到
jar裡面替換掉原來的,可以減小一點size.
8.MicroEdition-Profile: MIDP-1.0
MicroEdition-Configration: CLDC-1.0
Media-Price: 5元每次
這些只要手工加在jad裡面就行,build.xml裡面好像沒有選項加這個。
下面給出一個例子:bulid.xml
<?xml version="1.0"?>
<project name="LoveNote_S40" default="build" basedir=".">
<property name="build.compiler" value="classic"/>
<!-- Define the Siemens Mobility Toolkit home directory. Needed by the tasks. -->
<property name="wtk.home" value="C:WTK104"/>
<!-- Define some additional properties for this project. Not required. -->
<property name="midlet.name" value="LoveNote_S40"/>
<property name="midlet.home" value="."/>
<!-- Define the tasks. -->
<taskdef resource="antenna.properties"/>
<target name="clean">
<delete failonerror="false" dir="classes"/>
<delete failonerror="false">
<fileset dir=".">
<exclude name="build.xml"/>
</fileset>
</delete>
</target>
<target name="build">
<!-- Create a JAD file. -->
<wtkjad jadfile="LoveNote_S40.jad"
jarfile="LoveNote_S40.jar"
name="LoveNote"
vendor="websurf tech co., inc."
manifest="MANIFEST.MF"
version="1.0">
<midlet name="LoveNote" icon="/icons/icon.png" class="GameMidlet"/>
</wtkjad>
<!-- Make sure we have a fresh classes directory. -->
<delete dir="classes"/>
<mkdir dir="classes"/>
<!-- Compile everything, but don't preverify (yet). -->
<wtkbuild srcdir="${midlet.home}" destdir="classes" preverify="false" encoding="utf-8"/>
<!-- Package everything. -->
<wtkpackage jarfile="${midlet.name}.jar" jadfile="${midlet.name}.jad" manifest="MANIFEST.MF" obfuscate="true">
<fileset dir="classes"/>
<fileset dir="res"/>
</wtkpackage>
<!-- Preverify -->
<wtkpreverify jarfile="${midlet.name}.jar" jadfile="${midlet.name}.jad"
bootclasspath="${wtk.home}libmidpapi.zip"
classpath="${wtk.home}libextnokiaui.jar"/>
<!-- Start the MIDlet suite
<wtkrun jadfile="${midlet.name}.jad" wait="false" device="DefaultColorPhone"/> -->
</target>
</project>