1

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.

Murugesh
  • 1,009
  • 1
  • 12
  • 34

2 Answers2

1

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

Telmo Pimentel Mota
  • 4,033
  • 16
  • 22
  • Thanks Telmo,Please clear me one thing,If I write my own build.xml,it will be dependent on Antenna right? So is only Antenna's supporting JAR enough? What are the diffculties If I'm going to write build.xml without Antenna or other available Wireless Java ANT solution – Murugesh Jun 11 '12 at 06:39
  • I do not know if I got your question right... But let me share my experience. You do not have to add antenna jar to project build path. All you have to do is add the following line at build.xml Ok... this is an older version. But it is the one I use. If you do not want to use antenna you can still call javac and other tools useing Ant exec task. – Telmo Pimentel Mota Jun 11 '12 at 14:07
  • Ok Thanks!,Basically I'm developing an J2ME framework to build and run J2ME applications,so just wondered without depending on antenna or Antic or some other, how can I write the ant script to compile,preverify,obfuscate,create jad and all ! – Murugesh Jun 13 '12 at 08:55
  • Compile: javac task. Obfuscate: use obfuscator task, eg. http://proguard.sourceforge.net/#manual/ant.html Preverify: exec task with command="preverify.exe". Package: jar task. Jad: http://stackoverflow.com/questions/3732583/how-do-i-append-some-text-at-the-end-of-a-file-using-ant – Telmo Pimentel Mota Jun 13 '12 at 11:58
  • Thanks for valuable information ! In the mean time I gone thru Antenna and doing hands on,we are reconsidering to use such utilities. And I faced an issue while preverify using Antenna "[wtkpreverify] Cannot find jar or jar.exe in C:\Program Files\Java\jre1.5.0_22\bin, preverify will most likely fail", I had kept the jar.exe in the path also ! Pls provide ur knowledge – Murugesh Jun 13 '12 at 12:31
1

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>**
Murugesh
  • 1,009
  • 1
  • 12
  • 34