Java Reference
In-Depth Information
3.
When the J2ME Wireless Toolkit asks you for the name of the project and the MIDlet
class name, use “Jargoneer” for both.
4.
Click the Create Project button, and then the OK button to dismiss the project settings
window.
Figure 2-1 shows the New Project dialog box.
Figure 2-1. Creating a new project with the J2ME Wireless Toolkit
The J2ME Wireless Toolkit represents projects as subdirectories of its apps directory. The
following shows the contents of the Jargoneer directory after the new project is created:
<J2ME Wireless Toolkit directory>
apps
Jargoneer
bin
lib
res
src
Save the source code as Jargoneer.java in the project's src directory. You can simply click
the Build button in the J2ME Wireless Toolkit toolbar to compile the open project.
Behind the scenes, the J2ME Wireless Toolkit uses J2SE's compiler. Normally, when you're
compiling J2SE source code, the CLASSPATH environment variable points to all the classes that
your source code needs to know about. When you use javac to compile a file, there are some
implied APIs that get included, like the classes in java.lang . With MIDlets, however, the situation is
a little more complicated. Say that you use the java.lang.System class in your MIDlet. How do
you (or how does the J2ME Wireless Toolkit) let the compiler know that you want to use the
MIDP version of this class, not the J2SE version?
The answer is a command line option, -bootclasspath . This option lets you point to a
classpath that describes the fundamental APIs against which you will be compiling your source
code. In this case, this option should be used to specify the classes directory in the MIDP refer-
ence implementation installation. If you install the MIDP reference implementation, the
command line looks like this:
Search WWH ::




Custom Search