In the user interface, building a project is a single step. Behind the scenes, however, there are two steps. First, Java source files are compiled into Java class files. Next, the class files are preverified, which means they are prepared for the CLDC VM. See the following topics:
Before building and running an application from the command line, verify that you have a version no earlier than 1.5 of the Java SE software development kit. Make sure the jar command is in your path. To find the version of the development kit, run java -version at the command line.
Use the javac compiler from the Java SE development kit to compile Java source files. You can use the existing Java ME Platform SDK project directory structure. Use the -bootclasspath option to tell the compiler to use the MIDP APIs, and use the -d option to tell the compiler where to put the compiled class files.
The following example demonstrates how you might compile a MIDP 2.0 application, taking source files from the src directory and placing the class files in the tmpclasses directory. Newlines have been added for clarity.
javac -target 1.3 -source 1.3 -bootclasspath ../../lib/cldc_10.jar;../../lib/midp2.0.jar -d tmpclasses src/*.java
For more information on javac, consult the Java SE documentation.
The next step is to preverify the class files. The bin directory of the Java ME Platform SDK includes the preverify utility. The syntax for the preverify command is as follows:preverify files | directories
Some of the options are as follows:
Windowspreverify.exe -classpath ..\..\lib\cldcapi10.jar;..\..\lib\midpapi20.jar -d classes tmpclasses
Mac OS and Linuxpreverify -classpath ../../lib/cldc_10.jar;../../lib/midp2.0.jar -d classes tmpclasses
As a result of this command, preverified class files are placed in the classes directory. If your application uses WMA, MMAPI, or other versions of CLDC or MIDP, be sure to include the relevant .jar files in the classpath.