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\cldcapi10.jar;..\..\lib\midpapi20.jar -d tmpclasses src\*.java
For more information on javac, consult the Java SE documentation.