Use Java on BlackBerry devices
Compile the source code, package it into a. cod file, load the. cod file to the BlackBerry device, and run it through a virtual machine.
Note: The cod file name is limited to 128 bytes.
As described in CLDC, BlackBerry IDE uses a separate VM architecture. To reduce the amount of memory and the processing capability required by BlackBerry devices, the partial classification loading process is called pre-verification, which occurs before Java code is loaded to BlackBerry. It is automatically verified before the source code is packaged as A. cod file. The prompt that the verification is completed when the class is loaded to the BlackBerry device.
Restrictions
As described in CLDC1.1, BlackBerry virtual machines have the following restrictions:
◆ No object destructor finalization)
◆ No user class is loaded
◆ No reflection, so RMI and Jini network technologies are not supported.
◆ No Native method)
◆ No external process is executed by Runtime.exe c ().
Multithreading
The BlackBerry Java environment provides a real multi-threaded environment to run applications. This environment allows multiple applications to run at the same time, allows events to be broadcast to multiple applications, and long operation and listening threads to run behind the scenes.
Persistent data
Data stored in flash memory is permanently saved between BlackBerry resetting. One of the following two methods can be used to store data on a BlackBerry device:
◆ Use MIDP record storage
◆ Use the BlackBerry persistent Model
Network Communication
BlackBerry JDE implements network communication based on MIDP2.0. It provides a variety of connection options, including the ability to use HTTP Proxy connections to secure connections behind the corporate firewall.
BlackBerry JDE provides the following connection types:
◆ Stream connection interface, including:
1. HTTP connection HttpConnection Interface)
2. HTTPS connection to the HttpsConnection Interface)
3. Socket connection to the SocketConnection Interface)
4. Secure socket Connection to SecureConnection Interface)
5. A serial communication interface CoomConnection interface connecting to the BlackBerry device)
◆ Datagram connection to DtagramConnection Interface), including
1. UDP datagram connection udp1_ramconnection Interface)
The Javax. microedition. io. PushRegistry class maintains some inbound connections to BlackBerry devices.
Stream
BlackBerry JDE provides standard interfaces and classes for streams contained in CLDC java. io packages.
MIME Encoding
BlackBerry IDE provides the MIMEInputStream and MIMEOutputStream classes to read and write a MIME-encoded data stream.
Compression
In the net. rim. device. api. compress package, BlackBerry JDE provides classes to read data streams compressed using Zlib or GZip. The behavior of these classes is the same as that in the java.util.zip package in the Java standard version. By default, compression is allowed. BlackBerry devices can write valid GZip and Zlib files to compress the file content. Decompression is also supported.