How to port a MIDlet application to BlackBerry (1)

Source: Internet
Author: User

The BlackBerry platform is a Java platform that supports standard Java ME. Therefore, for Java ME developers, one direct way to enter the BlackBerry development world is to port the existing MIDlet to the BlackBerry platform. Porting A MIDlet to BlackBerry has different methods, from simple programs to complex project rewriting, which can be suitable for different developers and different projects. This article will introduce various methods to move the MIDlet program to the BlackBerry platform one by one, so that readers can easily enter the BlackBerry development world.

Note: This article is intended for developers who have some experience in Java ME development and need to port existing MIDlet applications to the BlackBerry platform. If you only want to develop a new BlackBerry Application, refer to other BlackBerry entry-level articles.

Use rapc to directly convert the MIDlet

The easiest way to run the MIDlet on a BlackBerry phone is to directly install the jar file on the BlackBerry phone. The BlackBerry phone itself has the ability to convert the jar file into cod, and then install and run it. The procedure is as follows:

1. Copy the jad and jar files of the application from the MIDlet to the BlackBerry media card.

2. open the file browser on the BlackBerry mobile phone

3. Find the jad file copied in step 1 and open the file.

4. The system displays the application download interface similar to the following interface. Select "Download" to start installation.

Of course, qualified developers can put the jad and jar files of the application by the MIDlet on the Internet. BlackBerry users can open the jad file through the BlackBerry browser to start OTA installation of the application.

However, in many cases, developers need to convert the jar file of the MIDlet to the cod file, so that users can deploy the application in a more formal way. You can use the compilation tool rapc provided by RIM to convert a MIDlet application into a cod file. The rapc application is a command line compilation tool that can convert java files or jar files into cod files. In fact, the BlackBerry Development Environment eventually calls rapc to compile the Code Compiled by the developer into a cod file. Therefore, to obtain the rapc application, one of the methods is to install the BlackBerry development environment. This program is included in both Blackberry JDE and Eclipse Plug-in For BlackBerry. You can find the rapc APPLICATION in THE \ plugins \ net. rim. ejde. componentpackxxxxxx \ components \ bin subdirectory of the installation directory. If you have not installed the BlackBerry development environment, you can try to find the rapc on the Internet. some third-party websites provide download of the rapc application.

As mentioned above, the rapc application is a command line tool that requires parameters to be configured for use. The parameters of the rapc application are listed as follows:

◆ Limport = (used to specify the packages required by RIMAPIs for application packages and other applications)

◆ Lcodename = (used to specify the compiled Application name. Generally, the name of the JAR file is the same)

◆ L-MIDlet (this parameter must be used if it is a MIDlet program. If it is not a MIDlet program, such as a toolkit, this parameter is not required)

◆ Ljad = (specify the JAD file name)

◆ L \ Filename_1.java \ Filename_2.java... (specify all java file names to be compiled. This refers to compiling java files)

◆ L \ JAR_filename.jar (specify the name of the jar file to be compiled. This refers to the compilation of the jar file)

The command for converting a MIDlet program into a cod file is as follows:

Rapc-import = Codename = -MIDletjad =

Where The full path of the file net_rim_api.jar, The name of the application to be converted, Indicates the jad file name of the MIDlet to be converted, Indicates the jar File Name of the MIDlet to be converted.

The following is an example of rapc:

 
 
  1. rapcimport="c:\ProgramFiles\ResearchinMotion\Blackberry JDE 4.5\lib\net_rim_api.jar" 
  2.  
  3. codename=virca-MIDlet jad=Virca.jad Virca.jar  

In this example, net_rim_api.jar is used in the BlackBerryJDE development environment, and the transformed MIDlet Application name is virca. If the reader uses Eclipse Plug-In for BlackBerry, The net_rim_api.jar file is In the following directory of the installation directory: "\ plugins \ net. rim. ejde. componentpackxxxxxx \ components \ bin ".

The cod file generated after the command is run can be directly loaded to the BlackBerry mobile phone using javaloader, another command line tool. The Javaloader tool can also be used in the directory "\ plugins \ net. rim. ejde. componentpackxxxxxx \ components \ bin ", the load command is as follows: Javaloader-uloadvirca.cod attention to the need to load the Blackberry phone through the USB cable to connect to the PC.

Of course, for many end users, javaloader is not an optional solution, and most end users will load applications through blackberrygatetopmanager. The corresponding alx file is required to load the application through blackberryshorttopmanager. There are some unofficial alx file generators on the Internet, which can generate an alx file for the application based on the cod file. In fact, the alx file is an xml description file, which can be compiled by developers themselves. The following is a basic alx file sample. developers can modify the sample based on their own application information to generate an alx file.

 
 
  1. <loader version=" 1 .0" > 
  2.  
  3. <app licationid=" MyVClient " > 
  4.  
  5. <name > </name > 
  6.  
  7. <description > </description> 
  8.  
  9. <version > </version> 


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.