views:

461

answers:

3

i am created a j2me project with this article(http://www.securitypronews.com/it/applicationdevelopment/spn-19-20030611J2MEUsingAntwithJ2ME.html) and now i have problem in add resources(same as images) and librabris (same as jar as zip files) . i am copied resources in "res" folder that is points in the this article but when i extract jar file this not have file not resource here .

thanks

+2  A: 

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.

mihi
can i add libraries (jar or zip files) with this tag (<include>) ?
dashtebash
if you want to add jars or zips inside your jar, you surely can. if you want to add the contents of them, you will have to <unjar> them to some temporary build directory and add that one then.
mihi
can you tell more ?and write a sample code for that artice ?
dashtebash
dear mihi, now i can add jars and zips directly but if i want add contents of them i have so problem !!! can you have some example from (securitypronews) article for me ?
dashtebash
I added an example of how to unjar a jar and jar it up again.
mihi
if i want add more jars i must unjar all them in "/libs" directory ?and also what i must set in <include name="**/*"/> ?(at the end i am so sorry for my stupid questions but i am beginer in ant and i have no more time for this project ... so thank you for your attention)
dashtebash
yes unjar all of them there.You just set **/* (yes, exactly this, two stars followed by a slash and one star) if you want to extract all files from the jar. Otherwiese you can set something like "**/*.class" or "**/somedir/*.class" or "**/somedir/**/*" or something else. See the examples in http://ant.apache.org/manual/CoreTypes/fileset.html
mihi
this is my build file (http://rapidshare.com/files/246931651/build.xml.html) but it's not work and c:\lib.jar is not extracted in libs ? is wrong my build file ?
dashtebash
you have to put the unjar into a target (best into the same target that jars the stuff up afterwards). The jar fileset looks okay.And please do not use R*pidsh*re for plain text files, there are hundreds of pastebin services for stuff like that...
mihi
thank you so a lot mihi again !!!
dashtebash
+1  A: 

thank you mihi

dashtebash
A: 

any example avail for eclipse pulsar integration with SUN JavaME SDK 3.0. I've above said development environment and stuck with Ant. Could anyone please put some light on it.

Thanx in advance Faisal