Skip navigation

When I originally wrote the build.xml for this project my main goal was just to get it to work. This lead to a really crappy handling of preverify where you had to add the class files manually as preverify doesn’t search subdirectories for class files. So today I finally got tired of having to edit build.xml every time I added a new class, or renamed an old one. Unfortunatly Google let me down except for some outdated J2ME Ant extensions, but after deciphering the Ant manual I came up with this vanilla Ant code:

<!-- Find class files. -->
<fileset dir="${build}" id="tmp">
      <include name="**/*.class">

<!-- Convert filenames to valid preverify input. -->
<!-- From: /absolute/path/to/package/SomeFile.class -->
<!-- To: package.SomeFile -->
<pathconvert pathsep=" " property="unverified" refid="tmp">
  <packagemapper from="${build}/*.class" to="*">

<!-- Execute preverify on classes. -->
<exec dir="${build}" executable="${j2me.bin}/preverify">
  <arg line="-classpath ${classpath.j2me}">
  <arg line="-d ${preverify}">
  <arg line="${unverified}">

Maybe this will save someone else’s time.


One Comment

  1. Hi, I tried your ant script and it works but after a short time solving a problem, my build directory is path relative, something like ‘build/classes’, so I had to put the basedir before the build dir like this

    After that my script still didn’t work, I noticed that in windows I have to have my relative paths with ‘\’, like this

    Thanks a lot for the script, it thought me something else about ant 🙂


Fyll i dina uppgifter nedan eller klicka på en ikon för att logga in: Logo

Du kommenterar med ditt Logga ut / Ändra )


Du kommenterar med ditt Twitter-konto. Logga ut / Ändra )


Du kommenterar med ditt Facebook-konto. Logga ut / Ändra )

Google+ photo

Du kommenterar med ditt Google+-konto. Logga ut / Ändra )

Ansluter till %s

%d bloggare gillar detta: