Compilation

Error preverifying class org.any.IOUtils VERIFIER ERROR org/any/IOUtils.load()V: Cannot find class java/io/FilterInputStream

This is beacuse you are compiling your code with J2SE java.io. And DataInputStream and DataOutputStream are inherited from FilterInputStream in J2SE The problem in close() function. Solution is to use InputStream.close(). Consider this example: Instead of:

   DataInputStream din = new DataInputStream(..);
   din.close();
                   
Use:
   DataInputStream din = new DataInputStream(..);
   ((InputStream)din).close();

    // or even better...

   silentClose(din);

   private void silentClose(InputStream is) {
        if (is == null) {
            return;
        }
        try {
            is.close();
        } catch (IOException ignore) {
        }
    }
               

[top]

How do I use cldcapi11.jar and midpapi20.jar instead of Java SE runtime libraries during compilation.

Add cldcapi11.jar to bootclasspath in maven-compiler-plugin

    ...
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source_>1.3</source_>
                    <target>1.1</target>
                    <fork>true</fork>
                    <compilerArguments>
                        <bootclasspath>${env.WTK_HOME}/lib/cldcapi11.jar${path.separator}${env.WTK_HOME}/lib/midpapi20.jar</bootclasspath>
                   </compilerArguments>
               </configuration>
           </plugin>
        ....
       </plugins>
   </build>

Alternatively you can use MicroEmulator SDK API modules licenesd under GNU General Public License version 2 (GPL).

N.B. This will not download API modules to your local maven repository. You need to have some sub project that have this modules in dependencies.

    ...
    <properties>
        <me2Version>2.0.2</me2Version>
   </properties>
    ...
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source_>1.3</source_>
                    <target>1.1</target>
                    <fork>true</fork>
                    <compilerArguments>
                        <bootclasspath>${settings.localRepository}/org/microemu/cldcapi11/${me2Version}/cldcapi11-${me2Version}.jar${path.separator}${settings.localRepository}/org/microemu/midpapi20/${me2Version}/midpapi20-${me2Version}.jar</bootclasspath>
                   </compilerArguments>
               </configuration>
           </plugin>
        ....
       </plugins>
   </build>
[top]

I get Error: No such file or directory just after message [WtkJad] Preverifying

Add %JAVA_HOME%\bin to the PATH variable in your environment.

[top]

I get multiple messages [proguard] Note: duplicate definition of library class ...

You probably have microemulator and WTK/lib/midpapi20.jar in ProGuard classpath.

Consider this example:
            <plugin>
                <groupId>com.pyx4me</groupId>
                <artifactId>j2me-maven-plugin</artifactId>
                <configuration>
                    ....
                    <libs>
                        <lib>${settings.localRepository}/org/microemu/cldcapi11/${me2Version}/cldcapi11-${me2Version}.jar</lib>
                        <lib>${settings.localRepository}/org/microemu/midpapi20/${me2Version}/midpapi20-${me2Version}.jar</lib>
                   </libs>
                    <dependencies>
                        <dependency>
                            <groupId>org.microemu</groupId>
                            <artifactId>microemulator</artifactId>
                            <exclude>true</exclude>
                       </dependency>
                   </dependencies>
               </configuration>
           </plugin>
[top]

I get Compilation failure: file java\io\Serializable.class not found

You probably have -Xlint java compiler argument enabled. Add -Xlint:-serial. See also javac -Xlint

    ...
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source_>1.3</source_>
                    <target>1.1</target>
                    <fork>true</fork>
                    <compilerArguments>
                        <Xlint:-serial></Xlint:-serial>
                        <bootclasspath>${env.WTK_HOME}/lib/cldcapi11.jar${path.separator}${env.WTK_HOME}/lib/midpapi20.jar</bootclasspath>
                   </compilerArguments>
               </configuration>
           </plugin>
        ....
       </plugins>
   </build>
[top]