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

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

问题描述

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

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.

推荐答案

来自示例:

<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>

这将仅包括 /res 文件夹中的 *.png 文件.如果要包含更多类型,请添加更多 行或包含 "${package_name}/**".

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}/**".

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

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>

Apache Ant 手册 包含所有支持标签的大量示例.

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

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

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