Java Reference
In-Depth Information
Note The codeBase attribute in the permissions block should match the codebase attribute in the JNLP
file. Note the difference in capitalization, too!
To use NetBeans to create a suitable deployment image, make sure you have
selected a destination path for the image in the project's properties (under the Deploy-
ment tab), such as the path to a Secure Digital (SD) card for the target hardware. Then
simply right-click the project and choose Deploy Target Bundle. When the build and
deployment are complete, you can transfer the media to the target hardware and exe-
cute your application.
Wrapping Up
Various tools are available for developing Java ME applications, but if you're just start-
ing out, one of the best is the NetBeans IDE for Java ME. Through the addition of two
optional packages—the NetBeans Mobility Pack for CLDC and the NetBeans Mobility
Pack for CDC—you can write Java ME applications on Linux or Windows platforms (or,
through virtualization, on other Intel-based platforms as well). The IDE provides a
visual editor for developing your application GUI as well as integrated build tools to
compile and build your CLDC or CDC applications.
CLDC/MIDP applications are called MIDlets and have a well-defined life cycle
that permits you to pause applications at any point during execution. CDC applica-
tions also have the same life cycle and are called Xlets. While you can use a subset of
Java Swing for many CDC-based applications, the same is not true of the CLDC/MIDP,
which requires you to use a GUI and event hierarchy developed expressly for con-
strained mobile devices.
While both the CLDC and the CDC use the same basic build process and build tool
chain, later steps of the build and packaging process diverge between the two environ-
ments. Both use the JDK's compiler, and you should be sure to use an obfuscator when
generating production code for either the CLDC or the CDC to save space. However, the
CLDC/MIDP splits bytecode verification into two phases, so CLDC/MIDP build environ-
ments must preverify the compiled byte code after obfuscation before packaging. Finally,
the mechanics of packaging differ between the two platforms; CLDC/MIDP devices use a
combination of a flat text file that describes the application and a JAR file, while CDC
applications generally use the same JNLP (consisting of an XML file and a class file)
mechanism used by desktop applications.
Despite the differences, the NetBeans IDE provides a unified visual development
environment with consistent tools for editing, debugging, building, and packaging Java
ME applications.
 
Search WWH ::




Custom Search