ANT scripts for J2ME Application Life Cycle - ant

I'm new to J2ME application development, I want to write an ANT script to build and run the application in the emulator. Assuming that I'm going to use JAVA_ME_Platform_SDK,
My main doubt is how do I can create the JAD file using ANT
apart from other building activities.

You can use Antenna http://antenna.sourceforge.net/.
"There are several sample build.xml files in the "samples" subdirectory of the Antenna source distribution. These files show how to build the default demo MIDlets contained in the Wireless Toolkit and some others. Running the samples is a good way to test your setup as well as a good starting point for your own build.xml files."

Finally I wrote the script to all the J2ME processes. For creating the JAD I've written the follwoing
**<target name="makeJAD">
<length file="${prototype}/bin/${PROGRAM_NAME}.jar" property="jarSize"/>
<echo file="${prototype}/bin/${PROGRAM_NAME}.jad">MIDlet-Jar-Size: ${jarSize}
MIDlet-1: ${PROGRAM_NAME},,${PACKAGE_NAME}.${PROGRAM_NAME}
MIDlet-Jar-URL: ${PROGRAM_NAME}.jar
MIDlet-Name: ${MIDLET_NAME}
MIDlet-Vendor: ${MIDLET_VENDOR}
MicroEdition-Configuration: ${CONFIG}
MicroEdition-Profile: ${PROFILE}
MIDlet-Version: ${MIDLET_VERSION}
</echo>
</target>**

Related

ant build.xml in SCons

I am making use of a library project which uses ant to build. My project however is using SCons because I need a far more complex build setup. Now I would like to use ant via SCons but NOT impose the problematic CLASSPATH issues and installation that ant requires.
So I am currently thinking of writing a build.xml parser, which turns the ant into SCons tasks.
Does anyone know whether this has been done before?
As far as I can tell there is no such parser in existence, which I partly believe is because there is great difference in how SCons and ant work. Especially when it comes to dependency resolution. It should be possible, but the translated file output will be very little SCons like, quite unreadable and probably quite difficult to maintain. Which pretty much defeats the whole reason to use SCons in the first place.
Since the library already uses ant, it would probably be a good idea to just incorporate the running of ant into SCons. If SCons can use ant, then you won't have to maintain the library build script (unless it is you that maintain the ant also)
Have you seen this: http://geosoft.no/development/android.html? We're also looking at converting an ANT based android build into our over-arching SCONS build and this looks like a good starting point.

Create Debian package using Apache Ant

Is there anywhere that can give you a tutorial or anything on creating a Debian package using Ant?
I'm being told its already a part of Ant but I've never seen any functions even remotely associated with it.
I don't want to use ant-deb-task either seeing as its not actually part of Ant.
There is no task for this in the core Ant distribution.
There are examples for ant-deb-task available in the examples file on the download page.
Another option is jdeb which also provides documentation.

How do I build the JavaME jars with ant? and can i do it while running in javaSE?

Hi I have source code that ant builds into a javaSE jar, and we ship that, ant also at the same time builds the source for a JavaME project.
which I currently then open netbeans and let it compile the jars for JavaME, i'd like to do this last bit in ant and wondered if its possible and if so how?
Sure, but you'll have to add tasks for pre-verification etc.
Have a look at
Antenna An Ant-to-End Solution For Wireless Java
User's Guide for J2ME Ant Tasks
From the webpage of Antenna:
Antenna provides a set of Ant tasks suitable for developing wireless Java applications targeted at the Mobile Information Device Profile (MIDP). With Antenna, you can compile, preverify, package, obfuscate, and run your MIDP applications (aka MIDlets), manipulate Java Application Descriptor (JAD) files, as well as convert JAR files to PRC files designed to run on the MIDP for PalmOS implementations from Sun and IBM.

From where RIM-COD-Module-Dependencies in JAD file come?

I wanted to know from where the values for RIM-COD-Module-Dependencies parameter are populated in Jad file of a Blackberry project ?
Generally this is done by RIM's RAPC tool. You invoke this when you do a build from the JDE or from the Eclipse JDE Plugin. You can also invoke this from the command line, or using something like bb-ant-tools.
RAPC does a bunch of things - compiling .java files to bytecode (using javac), doing preverification (like sun's WTK), doing some obfuscation/packing/optimization on your bytecode (stripping out unused bits of code, etc), and figuring out what dependencies your .cod will have.
Are you having specific problems with the module dependencies?

BlackBerry external jar

I am using JDom jar and I want to add to my blackberry project. I am using eclipse plugins for blacberry. while building blackberry app from eclipse the error is displayed on the console as
"JDOMAbout$info:error!missing stack map #label.... "
rapc falied for the project along with this several warnings are also displayed ...so any body have came across this ?
The stack map is part of what's generated when a jar file is preverified. Sounds like your jar is not J2ME ready. Assuming it's compatible with J2ME, the standard way is to create a .cod file from the .jar, and reference that in your project. Unfortunately you can't do that with the Eclipse plugin, but once you have the .cod, you can reference it in your Eclipse project.
You have to create a Blackberry archive or library project (or whatever it's called) and add your library to that, then reference it from your application project. You may or may not have to use the Blackberry JDE to do some hackery with the jdp file as well, but I can assure it works in Eclipse. We had the kSOAP library included in ours and Eclipse would 'build' it with rapc and generate the proper files (you sort of have to do it manually, by telling the project to build).
I unfortunately don't have an environment to check things right now, but the basic idea was have a second project, include the jar, and then reference that.
All that, and the jar has to be J2ME compatible.
Maybe You can find something useful and more J2ME friendly in kDom package of kXML project
Tutorial: How To Use 3rd Party Libraries in your Applications

Resources