Parting shots
Previously, we issued the following commands to compile and pre-verify our MIDlets:
javac -bootclasspath c:\j2me\midp1.0.3fcs\classes FirstMIDlet.java
preverify -classpath c:\j2me\midp1.0.3fcs\classes;. -d . FirstMIDlet
With this approach, the pre-verified class file overwrote the class file created by the compiler. For small applications, this is not much of an issue. However, as the complexity of your applications increase, so will the number of files that you need to juggle. One easy way to lend some organization is to place class files from the compiler and pre-verifier into separate directories.
Steps to separate class files:
#1 - Create new directories
Create directories with the names jclasses and pclasses.
These directories will hold the output from the compiler and pre-verifier, respectively.
#2 - Change command line syntax for compiler and pre-verifier
javac -bootclasspath c:\j2me\midp1.0.3fcs\classes -d jclasses *.java
preverify -classpath c:\j2me\midp1.0.3fcs\classes -d pclasses jclasses
-d jclasses informs the Java compiler to write the class files into the directory jclasses.
-d pclasses jclasses informs the pre-verifer to write the pre-verified class files into the directory pclasses. The reference to jclasses instructs the pre-verifier where to locate the class files to pre-verify.
#3 - Change command line for creating the JAR
jar cvfm MIDlets.jar manifest.txt -C pclasses . MIDlet1.png MIDlet2.png
-C pclasses . informs the JAR program to look in the directory pclasses and archive all (".") the files.
#4 - Load MIDlet suite
midp -classpath MIDlets.jar -Xdescriptor MIDlets.jad
Sun Microsystems provides a free J2ME Wireless Toolkit to simplify the development cycle when writing MIDlets. The toolkit manages project directories, compiles, pre-verifies, and packages MIDlets (creates the JAR and JAD). The toolkit also provides several emulators to preview MIDlets.
Download J2ME Wireless Toolkit at http://java.sun.com/products/j2mewtoolkit.

