Java Reference
In-Depth Information
Developing a Simple Application
This topic would not be a true programming book if the "Hello World" example was missing.
Actually, we need three different "Hello World" examples to cover the CLDC reference
implementation from Sun as well as the MIDP and PDAP CLDC profiles. The following sections
describe the steps necessary to compile and run a simple KVM program for each target platform.
Setting Up the System Environment Variables
If you are using one of the integrated development environments, you can probably skip the
installation parts of this section. Just type the example and click Build or Compile and then Run,
depending on the type of IDE you are using.
For command-line operation, it is helpful to insert the bin/win32 directory located in your
J2ME installation into the system search path. For the MIDP SDK, you need to add the
build/win32/tools directory to the system path as well. For Windows 95/98, this is
performed by adding the corresponding directory to the path command in the file
c:\autoexec.bat . If you're running Windows NT 4.0 or Windows 2000, open the Properties
dialog box by right-clicking on My Computer on your desktop and selecting Properties. The path
information is located in the Extended tab.
The kvm and preverify utilities are also available for Solaris and Linux. However, the
executables are located in different directories or download packages. Please refer to the
corresponding documentation for installation on Unix systems.
Testing the Setup
In order to work with the command-line oriented SDKs, the first step is to open a command line.
Windows users just need to click the Start button and choose Programs, followed by MS-DOS
Command Line. For Unix, the way a command shell window is opened differs, depending on the
Desktop Manager and the exact system setup. For many installations, you just need to click on the
shell symbol in the start bar.
Before beginning, it makes sense to perform a short test to see whether the environment is set up
correctly. Please do not skip the test: It will probably save you from spending time searching for
simple and avoidable problems.
To test whether the preverify command is in the system search path, type in the following
command:
C:\> preverify
The command should generate the following output (or similar):
Usage: preverify [options] classnames|dirnames ...
where options include:
-classpath <directories separated by ';'>
Directories in which to look for classes
-d <directory> Directory in which output is written (default
is ./output/)
@<filename> Read command line arguments from a text file
 
Search WWH ::




Custom Search