This plugin aims to breathe new life into legacy hardware by introducing modern development workflows to classic devices. It brings the modern, efficient Kotlin language to the classic BlackBerry Java OS and J2ME (Java Platform, Micro Edition) platforms.
Now, you can build applications for these classic platforms on any operating system (Windows, macOS, or Linux) with a single Gradle command.
- Truly Cross-Platform: Build your projects on Windows, macOS, and Linux.
- Dual-Platform Workflow:
- BlackBerry Platform: Use the
rapctask to build native apps, MIDlets, and libraries for BlackBerry OS, outputting.codfiles. - Generic J2ME: Use the
midlettask to build standard.jarand.jadfiles for J2ME-enabled devices.
- BlackBerry Platform: Use the
- Kotlin on Classic Platforms: Write your application code in modern, concise, and safe Kotlin.
- Compatibility & Enhancements: Includes built-in compatibility patches and enables the use of default methods in Kotlin interfaces.
- One-Click Packaging & Signing: Easily generate platform-specific, deployable files.
- Deployment Helper (Optional): Provides a
deploytask for BlackBerry to simplify the installation process.
Before you start, it is crucial to understand the limitations of the BlackBerry OS development environment.
The BlackBerry OS runs on Java ME CLDC, not a standard JDK.
- API Incompatibility: Most standard Java SE APIs are not available. You must use the proprietary APIs provided by the BlackBerry SDK.
- Language Features: Features like
defaultmethods in Java interfaces are not allowed.
- Enums Are Not Supported: The
enumkeyword in Kotlin is not compatible. Use constants or sealed classes as alternatives. - Interface Default Methods: This plugin enables support for Kotlin interface default methods by processing the bytecode.
- Standard Library: Many parts of the Kotlin standard library will not function if they rely on unavailable JDK classes.
- The target bytecode version is capped at Java 11.
- The plugin will automatically downgrade a higher
jvmTargetto 11.
- Reason: BlackBerry shut down its official signing services years ago. This is a platform-wide limitation.
- Consequence: Your application will run as an "unsigned" app and cannot access APIs that require signatures.
Ensure your project has the Kotlin JVM plugin applied. This plugin is designed to work alongside it.
build.gradle.kts
plugins {
kotlin("jvm") version "2.2.0" // Use a compatible Kotlin version
}Apply the RapcPlugin to your build script.
build.gradle.kts
apply<RapcPlugin>()Configure your application's metadata using the RapcExtension block. This information will be embedded in the final .cod file.
build.gradle.kts
//...
configure<RapcExtension> {
// javaLoader.set(file("path")) // javaloader.exe path, optional
// codOutputPath.set(file("build/dists")) // blackberry cod output path, default as build/dists
// midletOutputPath.set(file("build/dists")) // midlet jar output path, default as build/dists
app {
name = "org_mdvsc_rapc_sample" // The output COD or Jar(midlet) file name (without extension)
version = "1.0.0"
vendor = "MDVSC"
description = "A sample app built with Kotlin and RAPC Gradle Plugin."
// midlet = false // or true for compile Blackberry app as midlet mod
// library = false // or true for compile Blackberry library
// jarUrl = "abc.jar" midlet jar url field. default as name.jar
entry {
title = "MyApp" // Title shown on the BlackBerry home screen
// argumensts = "" // entry arguments.
icon {
normal = "icon.png"
// focus = "icon_hover.png" // Optional: icon on focus,if target midlet, this field not use.
}
}
// this["morekey"] = "value" // extra key value
}
}Run the rapc task to compile your Kotlin/Java source code and package it into a .cod file.
./gradlew rapc
Or targeting Generic J2ME jar compile, use task
./gradlew midlet
If need jad signed for j2me app, you can use task
./gradlew midlet-sign
This task generate jad for jar, and auto sign it by versign cer (expired).
After the build succeeds, you will find the final installable file in the build/dists/ directory (e.g., build/dists/org_mdvsc_rapc_sample.cod, or build/dists/org_mdvsc_rapc_sample-midlet.jar).
This is the universal method. Simply copy the generated .cod file (and any sibling .cod files if they exist) from the build/rapc/ directory to your BlackBerry device's SD card and install it from there.
For developers on Windows, the plugin can automate installation using javaloader.exe. This tool is part of the BlackBerry JDE/SDK and is not included with the plugin.
build.gradle.kts
configure<RapcExtension> {
//... (app configuration)
// Set the path to your JavaLoader executable
javaLoader.set("C:/BlackBerryJDE/bin/javaloader.exe")
}Then, run the deploy task. Make sure your device is connected via USB and recognized by your computer.
./gradlew deploy
This project is actively evolving. We welcome contributions to help us reach our goals.
- ✅ Current Support: BlackBerry Java OS / J2ME
▶️ Next Step: Bringing modern Kotlin development to a wider range of classic mobile devices.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
Contributions are welcome! Please feel free to open an issue or submit a pull request.