Sun Microsystems J2ME User Manual Page 116

  • Download
  • Add to my manuals
  • Print
  • Page
    / 134
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 115
104 J2ME Wireless Toolkit User’s Guide October 2004
B.2.1 Build
Using KToolbar, building a project is a single step. Behind the scenes, however,
there are actually 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 KVM.
Use the javac compiler from the J2SE SDK to compile Java source files. You can
use the existing J2ME Wireless Toolkit project directory structure. You’ll need to
use the -bootclasspath option to tell the compiler to use the MIDP APIs, and
you’ll use the -d option to tell the compiler where to put the compiled class files.
The following example shows how you could 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
-bootclasspath ..\..\lib\cldcapi10.jar;..\..\lib\midpapi20.jar
-d tmpclasses
src\*.java
If you want to use the optional APIs that are supported by the toolkit, add their
JAR files to the -bootclasspath option.
For more information on javac, consult the J2SE documentation.
The next step is to preverify the class files. In the bin directory of the J2ME
Wireless Toolkit lives a handy utility called preverify. The syntax for the
preverify command is as follows:
preverify [options] <files | directories>
Some of the options are as follows:
-classpath <classpath>
Specify the directories or JAR files (given as a semicolon-delimited list) from
which classes are loaded.
-d <output directory>
Specify the directory into which the preverifier should output classes. This
directory must exist before preverifying. If this option is not used, the preverifier
places the classes in a directory called output.
Following the example for compiling, use the following command to verify the
compiled class files. As before, newlines have been added for clarity.
preverify
-classpath ..\..\lib\cldcapi10.jar;..\..\lib\midpapi20.jar
-d classes
tmpclasses
Page view 115
1 2 ... 111 112 113 114 115 116 117 118 119 120 121 ... 133 134

Comments to this Manuals

No comments