PreviousNext

Compile code using the command line

The BlackBerry® JDE includes RAPC, a command line compiler. RAPC compiles .java and .jar files into .cod files that you can run in the BlackBerry® Smartphone Simulator or load onto BlackBerry devices.

The rapc.exe file is located in the bin subdirectory of your BlackBerry JDE installation.

Note: When you invoke rapc, use net_rim_api.jar as an input file. Use the command line argument with the -import= option to provide this .jar file to rapc.

RAPC accepts the following command line options in the following order:
Option
Option Format
Description

java | class | jar

The input files:

  • .java: A Java® source program file that javac must compile.
  • .class: A Java .class file that javac has compiled.
  • .jar: An archive of files that you need to include in the compilation set.

jad

An input file that contains application information. For example, it contains a list of attributes that the MIDP specification specifies.

-class

classname

The name of the class that contains the main entry point of the application; without this option, RAPC uses the first main(String[]) method it finds as the entry point.

-codename

=[path\[...]]filename

Specify the name and location of the output .cod file; typically the output .cod file uses the same name of the .jar file.

-library

=[path\[...]]filename

Specify the name and location of the output .cod file as a library.

-import

=file.jar[;...]

List dependent .jar files; for example list RIM APIs and other dependent libraries.

-midlet

Specify the .cod file as a midlet and generate a preverified .jar file.

-deprecation

Set the deprecation option when RAPC invokes the Java compiler.

-nowarn

Set the nowarn option when RAPC invokes the Java compiler.

-quiet

Display only errors.

-warning

Generate warning messages.

-verbose

Display information about RAPC activity. RAPC stores this information in intermediate and temporary files in the user's temporary folder. RAPC does not delete the temporary files.

-wx

Treat all warnings as errors.

-warnkey

=0xNNNNNNNN[;...]

Generate a warning if a key needs to be added to the .csl file.

-workspace

=filename

Add the filename to the .debug file for BlackBerry IDE browsing.

filename_1.java [additional .java files as required]

Specify the .java file name if you compile from Java files.

JAR_filename.jar

Specify the .jar file name if you compile from a .jar file.

For example, the following command line instruction compiles the SampleApp.jar file into a .cod file named SampleAppDriver.cod, as specified by the code name option:

rapc import=net_rim_api.jar codename=SampleApp\SampleAppDriver -midlet SampleApp.jad Samples\SamplaApp.jar


   BlackBerry