使用Ant编译j2me [英] Compiling j2me using Ant

查看:194
本文介绍了使用Ant编译j2me的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在参考本文后创建了一个J2ME项目 J2MEUsingAntwithJ2ME 。现在我在添加资源(如图像)和库(如jar和zip文件)有问题。
我已经复制了 res 文件夹中的资源,如本文所示,但是当我提取 .jar

$ p






$ b b

 < jar basedir =$ {build} / preverifiedobf
jarfile =$ {build} / bin / $ {program_name} .jar
manifest =bin / MANIFEST.MF>
< fileset dir =$ {top} / $ {res}>
< include name =$ {package_name} / *。png/>
< / fileset>
< / jar>

这将只包括 *。png 这些文件位于 / res 文件夹中。如果您想包含更多类型,请添加更多< include> 行或包含$ {package_name} / **



如果要包含现有.jar文件的内容,可以 unjar 他们喜欢这样:

 < mkdir dir =$ {build} / libs/> 
< unjar src =yourlibrary.jardest =$ {build} / libs/>

然后你可以再次加载它们:

 < jar basedir =$ {build} / preverifiedobf
jarfile =$ {build} / bin / $ {program_name} .jar
manifest =bin / MANIFEST.MF>
< fileset dir =$ {top} / $ {res}>
< include name =$ {package_name} / *。png/>
< / fileset>
< fileset dir =$ {build} / libs>
< include name =** / */>
< / fileset>
< / jar>

Apache Ant手册包含了所有支持的标签的很多示例。


I have created a J2ME project after referring to this article J2MEUsingAntwithJ2ME. Now I am having problems in adding resources (such as images) and libraries (such as jar and zip files). I have copied the resources in the res folder as shown in this article but when I extract the .jar file, it does not have any resources.

解决方案

From the sample:

<jar basedir="${build}/preverifiedobf"
     jarfile="${build}/bin/${program_name}.jar"
     manifest="bin/MANIFEST.MF">
  <fileset dir="${top}/${res}">
    <include name="${package_name}/*.png"/>
  </fileset>
</jar>

This will only include *.png files which are in /res folder. If you want to include more types, add more <include> lines or include "${package_name}/**".

If you want to include the content of existing .jar files, you can unjar them like this:

<mkdir dir="${build}/libs"/>
<unjar src="yourlibrary.jar" dest="${build}/libs" />

Then you can jar them up again:

<jar basedir="${build}/preverifiedobf"
     jarfile="${build}/bin/${program_name}.jar"
     manifest="bin/MANIFEST.MF">
  <fileset dir="${top}/${res}">
    <include name="${package_name}/*.png"/>
  </fileset>
  <fileset dir="${build}/libs">
    <include name="**/*"/>
  </fileset>
</jar>

The Apache Ant manual contains a lot of examples for all the supported tags.

这篇关于使用Ant编译j2me的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆