ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Dribin <>
Subject Preliminary J2ME/KVM tasks
Date Tue, 17 Apr 2001 07:51:50 GMT

I've created the following tags to help build Java 2, Micro Edition
(J2ME) applications using Ant:

  <mejavac>   - Micro Edition Java compiler.
  <preverify> - J2ME Preverifier.
  <jartoprc>  - Convert a jar file to a Palm Pilot application.

I just wrote 'em (so consider them alpha stage), but they *do* work
for me!  I've built a simple Hello World program that runs under the
KVM on my Palm Vx.  If you have trouble, please let me know!  I'd like
to make these generic enough to use under any J2ME platform.

To uses the tasks, add these lines to your build.xml:

  <taskdef name="mejavac" classname="org.dribin.dave.ant.MeJavac"/>
  <taskdef name="preverify" classname="org.dribin.dave.ant.Preverify"/>
  <taskdef name="jartoprc" classname="org.dribin.dave.ant.JarToPrc"/>

Grab this jar and make sure it is in your classpath when running Ant:

You also need to declare the property "j2me.home" which points to the
J2ME and KVM distribution.  For example, I set mine up like this:

  <property name="j2me.home" value="/usr/local/encap/j2me_cldc" />

NOTE: The <preverify> task runs an executable that is only available
for Linux, Win32, and Solaris.  I have only tried the Linux version,
so please give me some feedback for Win32 and Solaris.

For more info on J2ME, see:

Some crude documentation:


Compiles code for the J2ME platform.

Takes the same attributes as <javac>.  Sets up bootclasspath
accordingly for KVM.


    <mejavac srcdir="${}" destdir="${}">
      <classpath refid="lib.path" />


Preverifies class files for the J2ME platform.  Only runs under Linux,
Solaris, and Win32.  (Only tested under Linux. :-)

Takes the following arguments:

unverifieddir: Required - Path of unverified class files created by

verifieddir: Required - Path of directory to output verified class


    <preverify unverifieddir="${}"
               verifieddir="${build.verified}" />


Creates a PRC (Palm Pilot application) file from a jar file.

Takes the following arguments:

jarfile: Required - Path of jar file to convert.

prcfile: Required - Path of PRC file to create.

mainclass: Required - The main class of the jar file.

verbose: Optional - Boolean to set verbosity.  Default is false.

networking: Optional - Boolean to indicate program uses networking.
Default is false.

Example 1:

    <jar jarfile="${dist.jar}" basedir="${build.verified}" />
    <jartoprc jarfile="${dist.jar}" prcfile="${dist.prc}"
              mainclass="org.dribin.dave.kvm.HelloWorld" />

Example 2:

    <jar jarfile="${dist.jar}" basedir="${build.verified}" />
    <jartoprc jarfile="${dist.jar}" prcfile="${dist.prc}"
              verbose="true" networking="true" />



View raw message