我已经提到这篇文章 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>这将只包括 *。PNG 文件,这是在 / RES 文件夹中。如果您想包括更多种类,添加更多的&LT;包括&GT; 线或包括$ {包名} / **。
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文件的内容,您可以不能解压缩他们是这样的:
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
发布评论