Skip to content
Back to search

CodenameOne

Open-source framework for native apps from one Java codebase, with a custom-rendered UI you control across iOS, Android, desktop, web, and watches.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/codenameone/CodenameOne with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/codenameone/CodenameOne'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/codenameone--codenameone/badge.svg)](/listings/codenameone--codenameone)

HTML

<a href="/listings/codenameone--codenameone"><img src="/api/listings/codenameone--codenameone/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

The setup is covered in depth in [this article and video](https://www.codenameone.com/blog/building-codename-one-from-source-maven-edition.html).

<div> <a href="https://www.youtube.com/watch?v=H8-QMIsTHNc " target="_blank"><img src="https://i.imgur.com/X0xzM6H.jpg" alt="Building Codename One from Source - Maven Edition " img width="80%"> </a> </div>

**IMPORTANT:** *Building* the Codename One framework from source requires **JDK 8** -- some sub-modules must use `-source 1.5` and `-target 1.5` to maintain backward compatibility with parts of the toolchain, and newer JDKs cannot emit those targets.

*Running* a Codename One application (the simulator or the "Run as desktop app" target) supports **JDK 11 through 25** (Eclipse Temurin: <https://adoptium.net>).

Quick Start with Maven

git clone https://github.com/codenameone/CodenameOne
cd CodenameOne/maven
mvn install -Plocal-dev-javase

NOTE: The `-Plocal-dev-javase` profile is necessary for building the javase port. Without it, you'll get build errors.

This will build and install Codename One in your local Maven repository, including the `cn1app-archetype` and `cn1lib-archetype` Maven archetypes. This process can take a while since it automatically downloads dependencies with a size of ~1GB.

Now that Codename One is installed in your local Maven repository, you can use that version in a project instead of the release version. A new testing project can be quickly generated with the [Codename One initializr](https://start.codenameone.com).

After downloading and extracting the project, open its pom.xml file and and look for the `<cn1.version>` and `<cn1.plugin.version>` properties. Then change these to point to the version that got installed into your *local* maven repository by `mvn install -Plocal-dev-javase`. The locally built version will usually be a SNAPSHOT version (e.g. 7.0.21-SNAPSHOT).

Quick Start with Ant

**Getting and Building Sources**

$ git clone https://github.com/codenameone/CodenameOne
$ cd CodenameOne
$ ant

**Running Unit Tests**

$ ant test-javase

**Running Samples**

The Samples directory contains a growing set of sample applications. These samples aren't meant to be demos, but rather samples of how to use APIs.

You can launch the sample runner app from the command-line using:

$ ant samples

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 311 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. <h1 align=center>
  2. <img align=center width="100%" src="https://www.codenameone.com/github/CN1-Banner-Dark-Blue.jpg" />
  3. </h1>
  4. ![GitHub repo size](https://img.shields.io/github/repo-size/codenameone/CodenameOne?style=flat-square)
  5. ![GitHub top language](https://img.shields.io/github/languages/top/codenameone/CodenameOne?color=orange&style=flat-square)
  6. ![GitHub last commit](https://img.shields.io/github/last-commit/codenameone/CodenameOne?color=success&style=flat-square)
  7. ![GitHub license](https://img.shields.io/badge/license-GPL%20%2B%20CE-FFFF00?style=flat-square)
  8. [![GitHub Stars](https://img.shields.io/github/stars/codenameone/CodenameOne?label=GitHub%20stars&style=social)](https://github.com/codenameone/CodenameOne/stargazers/)
  9. ## 100% native. Fast. Full-stack Java.
  10. [Codename One](https://www.codenameone.com/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=overview) takes Java from your UI to your server, compiled to native code. Share models and typed APIs across the full stack, control the UI you ship, and deploy your server without a JVM. Target iOS, Android, desktop, watch and TV, with a JavaScript port for the web. Import supported Flutter, Swing/JavaFX, Kotlin Multiplatform/Compose and Android code. Published benchmarks below compare application size, startup and runtime costs, plus backend and crypto performance.
  11. The UI ships with your app, so you control its components and theme. Native interfaces and peer components give you access to platform SDKs and views. The framework is GPLv2 with the Classpath Exception: free for commercial applications, with no royalties.
  12. ## Start with a complete full-stack application
  13. Generate a complete application from Initializr, then make it your own. These templates include the Java client, backend, database and administration screens, with guides for running and customizing them. The template source is free under MIT-0.
  14. | [Savor — Food delivery](https://www.codenameone.com/savor/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=savor) | [Parley — Private messaging](https://www.codenameone.com/parley/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=parley) |
  15. | --- | --- |
  16. | <a href="https://www.codenameone.com/savor/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=savor"><img src="docs/developer-guide/img/savor-customer-home.png" alt="Savor restaurant browsing screen" width="200"></a><br><br>Customer, restaurant, courier and admin screens, with a Java backend for ordering, dispatch, tracking and payments. | <a href="https://www.codenameone.com/parley/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=parley"><img src="docs/developer-guide/img/parley-chats.png" alt="Parley conversations screen" width="200"></a><br><br>Chats, groups, voice and video calls, with a Java backend and an administration console. |
  17. | [Wayline — Ride hailing](https://www.codenameone.com/wayline/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=wayline) | [Skirmish — Multiplayer strategy](https://www.codenameone.com/skirmish/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=skirmish) |
  18. | --- | --- |
  19. | <a href="https://www.codenameone.com/wayline/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=wayline"><img src="docs/developer-guide/img/wayline-rider-home.png" alt="Wayline rider map and destination screen" width="200"></a><br><br>Rider, driver and admin screens, with a Java backend for matching, live trips, earnings and payments. | <a href="https://www.codenameone.com/skirmish/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=skirmish"><img src="docs/developer-guide/img/skirmish-battle.png" alt="Skirmish live battle screen" width="200"></a><br><br>Online battles, replays and progression, with a Java game server and a moderation console. |
  20. | [Dash — Endless runner](https://www.codenameone.com/dash/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=dash) | [Splat — Team paintball shooter](https://www.codenameone.com/splat/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=splat) |
  21. | --- | --- |
  22. | <a href="https://www.codenameone.com/dash/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=dash"><img src="docs/developer-guide/img/dash-party-chat.png" alt="Dash multiplayer city run with voice chat" width="200"></a><br><br>A 3D runner with a Java backend for voice-chat races, real-map city runs and server-verified leaderboards. | <a href="https://www.codenameone.com/splat/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=splat"><img src="docs/developer-guide/img/splat-match-practice.png" alt="Splat team paintball match" width="200"></a><br><br>A first-person 3D shooter with a Java backend: four-on-four matches, server-refereed play, lag-compensated shots, parties, replays and an admin console. |
  23. | [Pulse — Gym and fitness studio](https://www.codenameone.com/pulse/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=pulse) | [Slate — Appointment booking](https://www.codenameone.com/slate/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=slate) |
  24. | --- | --- |
  25. | <a href="https://www.codenameone.com/pulse/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=pulse"><img src="docs/developer-guide/img/pulse-member-home.png" alt="Pulse fitness studio member home screen" width="200"></a><br><br>Member, trainer, front desk and owner apps, with booking, waitlists, QR entry, billing and live heart-rate zones. | <a href="https://www.codenameone.com/slate/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=slate"><img src="docs/developer-guide/img/slate-book-slots.png" alt="Slate appointment booking time slots" width="200"></a><br><br>Client, provider and owner apps, with Java backend scheduling, deposits, waitlists and calendars synced both ways. |
  26. | [Bastion — Virtual banking](https://www.codenameone.com/bastion/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=bastion) | [Reel — Streaming and courses](https://www.codenameone.com/developer-guide/reel-users-guide/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=reel) |
  27. | --- | --- |
  28. | <a href="https://www.codenameone.com/bastion/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=bastion"><img src="docs/developer-guide/img/bastion-dashboard.png" alt="Bastion account balances and dashboard" width="200"></a><br><br>Customer accounts, transfers and a staff console, with a Java backend and double-entry ledger. Money and markets are simulated. | <a href="https://www.codenameone.com/developer-guide/reel-users-guide/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=reel"><img src="docs/developer-guide/img/reel-viewer-home.png" alt="Reel streaming catalog and continue-watching screen" width="200"></a><br><br>A viewer app, creator studio, moderation and admin screens, with a Java backend for subscriptions, rentals and courses. |
  29. | [Fieldline — Field service and inspections](https://www.codenameone.com/fieldline/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=fieldline) |
  30. | --- |
  31. | <a href="https://www.codenameone.com/fieldline/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=fieldline"><img src="docs/developer-guide/img/fieldline-today.png" alt="Fieldline technician day with the route on a map" width="200"></a><br><br>Technician and dispatch apps, with a Java backend whose scheduling engine plans the crew around skills, hours, time off and travel, plus AI photo diagnosis and sealed customer signatures. |
  32. [Generate your application](https://www.codenameone.com/initializr/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=template-start) · [Explore the complete templates](https://www.codenameone.com/demos/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=fullstack-samples)
  33. | What do you want to build? | Start here |
  34. | --- | --- |
  35. | A new Java app | [Generate a project](https://www.codenameone.com/initializr/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=app-start) or [try the browser playground](https://www.codenameone.com/playground/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=playground) |
  36. | A native Java service | [Build a backend](https://www.codenameone.com/developer-guide/backend/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=backend) with Spring-style APIs and no JVM in the deployed executable |
  37. | An app and its backend | [Share models and generated REST clients](https://www.codenameone.com/blog/java-backend-shared-models/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=shared-models) |
  38. | An existing Android app on more platforms | [Import classic Android application code](https://www.codenameone.com/developer-guide/android-interop/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=android-import), including activities, XML layouts and resources |
  39. | An existing Swing or JavaFX app | [Import desktop Java source](https://www.codenameone.com/developer-guide/desktop-interop/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=desktop-import) and compile supported Swing, SwingX, JavaFX, FXML and CSS for phones, desktop and web |
  40. | A Kotlin Multiplatform / Compose app | [Import shared Kotlin and Compose screens](https://www.codenameone.com/developer-guide/kotlin-multiplatform-interop/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=kmp-import) and use Codename One APIs from the same project |
  41. | Existing Flutter screens | [Compile supported Dart and Flutter code to Java](https://www.codenameone.com/developer-guide/flutter-interop/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=flutter-import); experimental compatibility, with interaction limits documented in the guide |
  42. | A complete full-stack application | [Choose a template](#start-with-a-complete-full-stack-application): food delivery, messaging, ride hailing, multiplayer games, fitness, appointment booking, field service, virtual banking or streaming and courses |
  43. | Bring Python code | [Compile supported Python modules to Java](https://www.codenameone.com/developer-guide/python-interop/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=python-interop) for apps and native Java backends; no Python interpreter ships in the executable |
  44. | Evidence before adopting | [Compare performance](#measured-performance) and [inspect platform support](https://www.codenameone.com/port-status/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=platforms) |
  45. ### A backend that compiles the wiring into your application
  46. Write controllers, dependency injection, transactions and scheduled jobs with Spring-style annotations. The build generates routing and wiring as ordinary code, then ParparVM translates Java bytecode to C and the native toolchain compiles the executable. Develop and debug on the JVM; deploy a native service without it.
  47. The backend includes PostgreSQL, MySQL/MariaDB and SQLite access, managed ORM, WebSockets, sessions, an OAuth2/OIDC security stack, database migrations, OpenTelemetry and MCP tools. Initializr offers **App with backend** and **Backend only** project types.
  48. Serve browser pages with [compiled HTML views](https://www.codenameone.com/developer-guide/backend-views/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=backend-views), Java controllers and htmx. The build turns a supported subset of Thymeleaf attributes into Java renderers that compile with the native service.
  49. This is an evolving backend with its own supported API surface. Its annotations live in `com.codename1.backend.annotations`; it is not a drop-in Spring Boot replacement and does not run arbitrary JVM libraries. Start with the [backend guide](https://www.codenameone.com/developer-guide/backend/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=backend-guide) and its compatibility limits.
  50. ### Bring classic Android apps to iOS, desktop and the web
  51. Import an Android Studio module with `cn1:import-android-project`, or place its sources in `common/src/main/android`. The compatibility layer implements supported `android.*` and AndroidX APIs over Codename One, including activities, fragments, XML layouts, RecyclerView, ConstraintLayout and Material Components. It also covers Room entities and DAOs, WorkManager, location, sensors, foreground services, document pickers and AES keys through the AndroidKeyStore API. Java and Kotlin sources are supported.
  52. The application runs through Codename One's ports without an Android runtime on the other platforms. Check the [supported APIs and limitations](https://www.codenameone.com/developer-guide/android-interop/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=android-coverage) against your application's data flows: Room and background work have documented limits, and imported keystore keys do not preserve hardware-backed or user-authentication guarantees.
  53. The Android port also [runs without Google Play Services](https://www.codenameone.com/developer-guide/android-without-google-play/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=android-aosp) on systems such as GrapheneOS and LineageOS. The same APK selects available services at runtime; UnifiedPush is an optional push route. Play Billing and other Play-dependent features require their documented services.
  54. ### Bring Flutter, Swing/JavaFX and Compose code with you
  55. | Existing application | What carries over | Check before porting |
  56. | --- | --- | --- |
  57. | Flutter | Dart source compiles to Java; supported widgets render through Codename One. Maven and Gradle builds, with Dart source debugging. | Experimental; verified against the Flutter Gallery. Some callbacks and parameters are ignored. [Import steps and API coverage](https://www.codenameone.com/developer-guide/flutter-interop/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=flutter-coverage) |
  58. | Swing / JavaFX | Supported Swing, SwingX and JavaFX source, with FXML and JavaFX CSS compiled at build time. Mix imported panels with Codename One components. | API subsets; unsupported calls fail the build. Third-party desktop JARs and runtime reflection need porting. [Import steps and API coverage](https://www.codenameone.com/developer-guide/desktop-interop/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=desktop-coverage) |
  59. | Kotlin Multiplatform / Compose | Shared `commonMain` code and supported composables, using the real Compose runtime over Codename One components. Call Java APIs alongside Kotlin. | Check the supported UI APIs; missing composables and modifiers fail the build. [Import steps and API coverage](https://www.codenameone.com/developer-guide/kotlin-multiplatform-interop/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=kmp-coverage) |
  60. Experimental compatibility also covers [supported Unity 2D projects](https://www.codenameone.com/developer-guide/unity-interop/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=unity-import). Check the documented API limits before porting; 3D rendering is outside this compatibility layer.
  61. ### Wallets and accelerated cryptography in the app and server
  62. Use the same Java APIs for Ethereum/EVM, Bitcoin and Solana wallets: key derivation, addresses, transaction signing and node clients. Native kernels accelerate signatures and hashes; `CryptoBatch` spreads verification across CPU cores and uses Metal, Vulkan or WebGPU on supported devices. GPU work uses public data, never private keys. Portable Java paths cover other environments.
  63. [Explore wallet APIs, async batches and crypto benchmarks](https://www.codenameone.com/developer-guide/crypto-wallets/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=crypto-wallets). GPU gains depend on the device and batch size; the comparison below separates single-operation performance from parallel batches.
  64. ### Measured performance
  65. These are published reference measurements, not a promise about every application. Each comparison uses a different workload; follow the links for hardware, commands and raw results.
  66. | Comparison | Recorded result | Scope |
  67. | --- | --- | --- |
  68. | Flutter Gallery | **395 vs 1,247 ms cold start; 46 vs 79 MB idle memory** | Same Dart source, Android emulator, matched release builds; October 29 measurements, published October 30. Not phone measurements. iOS startup/memory are unmeasured; Flutter wins some compute workloads. [Results and methodology](https://www.codenameone.com/blog/flutter-better-in-java/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=performance-flutter). |
  69. | Swing / JavaFX | **SwingSet2: 8.2 vs 34.1 MB; JavaFX gallery: 7.1 vs 39.1 MB** zipped | Linux native executables versus the same apps with trimmed `jlink` runtimes; shared system libraries excluded. JavaFX gallery first paint: **116 ms native vs 422 ms tuned JVM (637 ms default)**, median of seven launches on a software framebuffer. [All eight apps and harness](https://www.codenameone.com/developer-guide/desktop-interop/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=performance-desktop). |
  70. | Kotlin Multiplatform / Compose | **4.58 vs 19.24 ms** state change to drawn | Same Keynote `commonMain`, CN1 Compose versus Compose Multiplatform. iPhone 17 Pro simulator, Xcode 27, Apple silicon, five release runs; not device frame rates. The separate imperative Java version takes **1.49 ms**. [Results and harness](https://www.codenameone.com/developer-guide/kotlin-multiplatform-interop/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=performance-kmp). |
  71. | Native crypto / OpenSSL | **39,129 vs 17,521 Ed25519 verifications/s (2.23×)** | Single-operation native comparison, M4 Max, OpenSSL 3.6.3, matched compiler flags. Android ECDSA verification separately measured **6.00× BouncyCastle** on an ARM64 API 36 emulator. Multi-core batch ratios use a serial reference and are not single-core speedups; some hash workloads favor the reference. [All kernels, GPU results and harnesses](https://www.codenameone.com/developer-guide/crypto-wallets/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=performance-crypto). |
  72. | HotSpot / JDK 25 | **37.5% less elapsed time and 45.8% less peak memory** for ParparVM self-translation | Linux ARM64 Neoverse N2 baseline, seven calibration runs, identical generated files. [All machines and workloads](https://www.codenameone.com/blog/parparvm-four-byte-header/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=performance-hotspot). Allocation-heavy code can favor HotSpot. |
  73. | Spring Boot 4.1.1 / JDK 25 | **3.9× plaintext and 3.4× JSON throughput** | Two pinned server CPUs in a Linux ARM64 VM on an M4 Max, 32 connections, matched 60-second warmup. Lower-level CN1 HTTP handlers versus Spring MVC/Tomcat; no database, TLS or authentication. [Methodology and reproduction bundle](https://www.codenameone.com/blog/java-server-work-before-startup/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=performance-spring). |
  74. | Go / fasthttp | **595,610 vs 496,293 requests/s** | Separate plaintext test: CN1 native musl, two pinned cores, 64 connections, medians of three interleaved runs. Go used less memory and a smaller binary. [Full comparison](https://www.codenameone.com/developer-guide/backend-operations/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=performance-go). |
  75. | Python / Java | **6 of 11 workloads within 15% of Java time** | Compiled Python and Java in the same Codename One JVM benchmark run. The other five Python workloads took 1.5–3.4× Java time. These are desktop/JVM measurements, not Android or iOS results. [Workloads, memory and comparisons with CPython, PyPy and GraalPy](https://www.codenameone.com/developer-guide/python-interop/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=performance-python). |
  76. The Spring comparison measures selected HTTP stacks, not equivalent framework features or the cost of CN1's annotation-generated controllers. The HotSpot comparison measures our compiler workload; the linked results also show workloads where HotSpot is faster. Measure your own service before sizing a deployment.
  77. ### Build and test the whole application
  78. - **UI you control:** CSS themes, Liquid Glass and Material 3, layouts, animation, vector graphics and custom drawing. Embed platform views where needed.
  79. - **Shared app and server code:** typed REST contracts, generated clients, entities and persistence APIs, with platform-specific code kept behind explicit boundaries.
  80. - **Local development:** simulator, device skins, component and network inspectors, live CSS, JUnit and screenshot tests. Maven and Gradle tooling are available.
  81. - **Coding-agent tools:** generated project instructions and semantic MCP tools for the simulator and JavaSE-hosted tooling. Native development builds can expose the same UI through loopback sockets on supported ports, including Linux; device connections require forwarding. See the [MCP setup and development-build restrictions](https://www.codenameone.com/developer-guide/mcp-headless-api/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=agent-mcp).
  82. - **Device integration:** camera, notifications, maps, Bluetooth LE, biometrics, secure storage and native SDK access.
  83. - **Native build options:** use local toolchains or the optional cloud service, including iOS builds from Windows or Linux. The free cloud tier includes 100 build credits per month.
  84. ### Supported targets
  85. | Form factor | Targets |
  86. | --- | --- |
  87. | Mobile | Android and iOS |
  88. | Desktop | Native Windows, Linux and macOS; JVM desktop applications |
  89. | Web | JavaScript applications and installable PWAs |
  90. | TV | Apple TV (tvOS) and Android TV / Google TV |
  91. | Watch | Apple Watch (watchOS) and Wear OS |
  92. | Vehicle | Apple CarPlay and Android Auto integrations |
  93. | Server | Native Java backend; JVM development mode |
  94. Check [Port Status](https://www.codenameone.com/port-status/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=port-status) for each target's architecture, OS requirements and test coverage.
  95. ## How does it work?
  96. ParparVM translates reachable JVM bytecode into C for the native Apple, Windows, Linux and backend targets. The platform compiler builds the generated code together with the runtime. Android applications use the Android toolchain; the JavaScript port produces browser applications. JavaSE powers the JVM desktop target and simulator.
  97. Codename One draws its portable UI rather than wrapping every platform widget. Native interfaces and `PeerComponent` connect it to platform SDKs and views. The Android compatibility layer compiles supported Android resources and API calls into this same application model.
  98. ## Quick start and documentation
  99. [Generate a project](https://www.codenameone.com/initializr/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=quick-start), choose an app, app with backend, or backend-only project, and follow the [getting-started guide](https://www.codenameone.com/getting-started/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=getting-started).
  100. - [Developer guide](https://www.codenameone.com/developer-guide/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=developer-guide)
  101. - [Client Javadoc](https://www.codenameone.com/javadoc/) and [backend Javadoc](https://www.codenameone.com/backend/javadoc/)
  102. - [Libraries and native integrations](https://www.codenameone.com/cn1libs/)
  103. - [Engineering blog](https://www.codenameone.com/blog/?utm_source=github&utm_medium=oss&utm_campaign=repo-readme&utm_content=engineering)
  104. - [GitHub Discussions](https://github.com/codenameone/CodenameOne/discussions)
  105. ## Setup & Getting Started With The Code
  106. The setup is covered in depth in [this article and video](https://www.codenameone.com/blog/building-codename-one-from-source-maven-edition.html).
  107. <div>
  108. <a href="https://www.youtube.com/watch?v=H8-QMIsTHNc " target="_blank"><img src="https://i.imgur.com/X0xzM6H.jpg" alt="Building Codename One from Source - Maven Edition
  109. " img width="80%"> </a>
  110. </div>
  111. **IMPORTANT:** *Building* the Codename One framework from source requires **JDK 8** -- some sub-modules must use `-source 1.5` and `-target 1.5` to maintain backward compatibility with parts of the toolchain, and newer JDKs cannot emit those targets.
  112. *Running* a Codename One application (the simulator or the "Run as desktop app" target) supports **JDK 11 through 25** (Eclipse Temurin: <https://adoptium.net>).
  113. ### Quick Start with Maven
  114. ~~~~
  115. git clone https://github.com/codenameone/CodenameOne
  116. cd CodenameOne/maven
  117. mvn install -Plocal-dev-javase
  118. ~~~~
  119. NOTE: The `-Plocal-dev-javase` profile is necessary for building the javase port. Without it, you'll get build errors.
  120. This will build and install Codename One in your local Maven repository, including the `cn1app-archetype` and `cn1lib-archetype` Maven archetypes. This process can take a while since it automatically downloads dependencies with a size of ~1GB.
  121. Now that Codename One is installed in your local Maven repository, you can use that version in a project instead of the release version.
  122. A new testing project can be quickly generated with the [Codename One initializr](https://start.codenameone.com).
  123. After downloading and extracting the project, open its pom.xml file and and look for the `<cn1.version>` and `<cn1.plugin.version>` properties.
  124. Then change these to point to the version that got installed into your *local* maven repository by `mvn install -Plocal-dev-javase`. The locally built version will usually be a SNAPSHOT version (e.g. 7.0.21-SNAPSHOT).
  125. ### Quick Start with Ant
  126. **Getting and Building Sources**
  127. ~~~~
  128. $ git clone https://github.com/codenameone/CodenameOne
  129. $ cd CodenameOne
  130. $ ant
  131. ~~~~
  132. **Running Unit Tests**
  133. ~~~~
  134. $ ant test-javase
  135. ~~~~
  136. **Running Samples**
  137. The Samples directory contains a growing set of sample applications. These samples aren't meant to be demos, but rather samples of how to use APIs.
  138. You can launch the sample runner app from the command-line using:
  139. ~~~
  140. $ ant samples
  141. ~~~
  142. ## ParparVM
  143. Codename One's native compiler is open source. You can read more about it [in its dedicated folder in this repository](https://github.com/codenameone/CodenameOne/tree/master/vm).
  144. ParparVM translates Java bytecode to portable C, performs reachability analysis to remove unused code, and then hands the generated project to the target's native compiler. It powers the native Apple, Windows, Linux and backend targets.
  145. You can open the generated native project and use the platform's debugger and profiler directly. On Apple platforms, for example, the output is a standard Xcode project with readable call stacks and native performance tooling.
  146. ## Help Improve Codename One
  147. <img align="right" src="http://codenameone.com/github/new_icon.png" height="150">
  148. Outside pull requests are disabled because even a small framework change can interact with the repository's cross-platform build and screenshot pipelines. The maintainers integrate code changes after running that matrix.
  149. You can still materially improve the project:
  150. - Ask usage and API-design questions in [GitHub Discussions](https://github.com/codenameone/CodenameOne/discussions).
  151. - File [GitHub Issues](https://github.com/codenameone/CodenameOne/issues/new/choose) for reproducible bugs, performance counterexamples, toolchain compatibility problems, and documentation gaps.
  152. - Include a minimal project, the affected target, Codename One and JDK versions, complete logs, and screenshots where they help.
  153. - Challenge the published benchmarks and architecture. A counterexample we can reproduce is more useful than a general feature request.
  154. Read [How to Help Improve Codename One](CONTRIBUTING.md) before opening a report. The [`codenameone` tag on Stack Overflow](https://stackoverflow.com/tags/codenameone) also contains years of community questions and answers.
  155. <br>
  156. ## Project Contributors
  157. Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
  158. <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
  159. <!-- prettier-ignore-start -->
  160. <!-- markdownlint-disable -->
  161. <table>
  162. <tbody>
  163. <tr>
  164. <td align="center" valign="top" width="14.28%"><a href="https://github.com/beazl-peter"><img src="https://avatars.githubusercontent.com/u/68695557?v=4?s=100" width="100px;" alt="beazl-peter"/><br /><sub><b>beazl-peter</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=beazl-peter" title="Code">💻</a></td>
  165. <td align="center" valign="top" width="14.28%"><a href="https://github.com/liannacasper"><img src="https://avatars.githubusercontent.com/u/67953602?v=4?s=100" width="100px;" alt="liannacasper"/><br /><sub><b>liannacasper</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=liannacasper" title="Documentation">📖</a></td>
  166. <td align="center" valign="top" width="14.28%"><a href="https://github.com/sergeyCodenameOne"><img src="https://avatars.githubusercontent.com/u/69102702?v=4?s=100" width="100px;" alt="sergeyCodenameOne"/><br /><sub><b>sergeyCodenameOne</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=sergeyCodenameOne" title="Code">💻</a></td>
  167. <td align="center" valign="top" width="14.28%"><a href="https://github.com/ThomasH99"><img src="https://avatars.githubusercontent.com/u/16265939?v=4?s=100" width="100px;" alt="ThomasH99"/><br /><sub><b>ThomasH99</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=ThomasH99" title="Code">💻</a></td>
  168. <td align="center" valign="top" width="14.28%"><a href="https://www.groupsapp.online"><img src="https://avatars.githubusercontent.com/u/11293898?v=4?s=100" width="100px;" alt="Javier Anton"/><br /><sub><b>Javier Anton</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=javieranton-zz" title="Code">💻</a></td>
  169. <td align="center" valign="top" width="14.28%"><a href="https://diamonddevgroup.com"><img src="https://avatars.githubusercontent.com/u/7268931?v=4?s=100" width="100px;" alt="Diamond"/><br /><sub><b>Diamond</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=diamondobama" title="Code">💻</a></td>
  170. <td align="center" valign="top" width="14.28%"><a href="https://www.informatica-libera.net/"><img src="https://avatars.githubusercontent.com/u/1997316?v=4?s=100" width="100px;" alt="Francesco Galgani"/><br /><sub><b>Francesco Galgani</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=jsfan3" title="Code">💻</a></td>
  171. </tr>
  172. <tr>
  173. <td align="center" valign="top" width="14.28%"><a href="https://github.com/kutoman"><img src="https://avatars.githubusercontent.com/u/5825645?v=4?s=100" width="100px;" alt="kutoman"/><br /><sub><b>kutoman</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=kutoman" title="Code">💻</a></td>
  174. <td align="center" valign="top" width="14.28%"><a href="https://github.com/ramsestom"><img src="https://avatars.githubusercontent.com/u/636758?v=4?s=100" width="100px;" alt="ramsestom"/><br /><sub><b>ramsestom</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=ramsestom" title="Code">💻</a></td>
  175. <td align="center" valign="top" width="14.28%"><a href="https://github.com/Maaartinus"><img src="https://avatars.githubusercontent.com/u/2324516?v=4?s=100" width="100px;" alt="Maaartinus"/><br /><sub><b>Maaartinus</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=Maaartinus" title="Code">💻</a></td>
  176. <td align="center" valign="top" width="14.28%"><a href="https://github.com/DurankGts"><img src="https://avatars.githubusercontent.com/u/16245755?v=4?s=100" width="100px;" alt="Durank"/><br /><sub><b>Durank</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=DurankGts" title="Code">💻</a></td>
  177. <td align="center" valign="top" width="14.28%"><a href="https://boardspace.net/"><img src="https://avatars.githubusercontent.com/u/5963076?v=4?s=100" width="100px;" alt="ddyer0"/><br /><sub><b>ddyer0</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=ddyer0" title="Code">💻</a></td>
  178. <td align="center" valign="top" width="14.28%"><a href="https://github.com/carlosverdier"><img src="https://avatars.githubusercontent.com/u/14301433?v=4?s=100" width="100px;" alt="carlosverdier"/><br /><sub><b>carlosverdier</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=carlosverdier" title="Code">💻</a></td>
  179. <td align="center" valign="top" width="14.28%"><a href="https://github.com/Firethunder"><img src="https://avatars.githubusercontent.com/u/1608647?v=4?s=100" width="100px;" alt="Robert Edelmann"/><br /><sub><b>Robert Edelmann</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=Firethunder" title="Code">💻</a></td>
  180. </tr>
  181. <tr>
  182. <td align="center" valign="top" width="14.28%"><a href="https://github.com/Adalbert393"><img src="https://avatars.githubusercontent.com/u/18614910?v=4?s=100" width="100px;" alt="Adalbert393"/><br /><sub><b>Adalbert393</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=Adalbert393" title="Code">💻</a></td>
  183. <td align="center" valign="top" width="14.28%"><a href="http://sjhannah.com"><img src="https://avatars.githubusercontent.com/u/2677562?v=4?s=100" width="100px;" alt="Steve Hannah"/><br /><sub><b>Steve Hannah</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=shannah" title="Code">💻</a></td>
  184. <td align="center" valign="top" width="14.28%"><a href="https://github.com/digappsepp"><img src="https://avatars.githubusercontent.com/u/32707062?v=4?s=100" width="100px;" alt="digappsepp"/><br /><sub><b>digappsepp</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=digappsepp" title="Code">💻</a></td>
  185. <td align="center" valign="top" width="14.28%"><a href="https://github.com/Pavneet-Sing"><img src="https://avatars.githubusercontent.com/u/11755381?v=4?s=100" width="100px;" alt="Pavneet Singh"/><br /><sub><b>Pavneet Singh</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=Pavneet-Sing" title="Code">💻</a></td>
  186. <td align="center" valign="top" width="14.28%"><a href="https://github.com/vprise"><img src="https://avatars.githubusercontent.com/u/16166226?v=4?s=100" width="100px;" alt="vprise"/><br /><sub><b>vprise</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=vprise" title="Documentation">📖</a></td>
  187. <td align="center" valign="top" width="14.28%"><a href="https://jrmydev.000webhostapp.com/"><img src="https://avatars.githubusercontent.com/u/10810617?v=4?s=100" width="100px;" alt="JrmyDev"/><br /><sub><b>JrmyDev</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=JrmyDev" title="Code">💻</a></td>
  188. <td align="center" valign="top" width="14.28%"><a href="https://csdesigninc.ca"><img src="https://avatars.githubusercontent.com/u/1958073?v=4?s=100" width="100px;" alt="Terry Wilkinson"/><br /><sub><b>Terry Wilkinson</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=twilkinson" title="Code">💻</a></td>
  189. </tr>
  190. <tr>
  191. <td align="center" valign="top" width="14.28%"><a href="https://github.com/jaanushansen"><img src="https://avatars.githubusercontent.com/u/11716510?v=4?s=100" width="100px;" alt="Jaanus Hansen"/><br /><sub><b>Jaanus Hansen</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=jaanushansen" title="Code">💻</a></td>
  192. <td align="center" valign="top" width="14.28%"><a href="https://github.com/jegesh"><img src="https://avatars.githubusercontent.com/u/6535446?v=4?s=100" width="100px;" alt="Yaakov Gesher"/><br /><sub><b>Yaakov Gesher</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=jegesh" title="Code">💻</a></td>
  193. <td align="center" valign="top" width="14.28%"><a href="https://github.com/Munken"><img src="https://avatars.githubusercontent.com/u/773660?v=4?s=100" width="100px;" alt="Michael Munch"/><br /><sub><b>Michael Munch</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=Munken" title="Code">💻</a></td>
  194. <td align="center" valign="top" width="14.28%"><a href="https://github.com/saeder"><img src="https://avatars.githubusercontent.com/u/9945131?v=4?s=100" width="100px;" alt="saeder"/><br /><sub><b>saeder</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=saeder" title="Code">💻</a></td>
  195. <td align="center" valign="top" width="14.28%"><a href="https://neptunedreams.com"><img src="https://avatars.githubusercontent.com/u/19262903?v=4?s=100" width="100px;" alt="Miguel Muñoz"/><br /><sub><b>Miguel Muñoz</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=SwingGuy1024" title="Code">💻</a></td>
  196. <td align="center" valign="top" width="14.28%"><a href="https://ahmedengu.com"><img src="https://avatars.githubusercontent.com/u/2976004?v=4?s=100" width="100px;" alt="Ahmed Aboumalwa"/><br /><sub><b>Ahmed Aboumalwa</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=ahmedengu" title="Code">💻</a></td>
  197. <td align="center" valign="top" width="14.28%"><a href="https://github.com/FabioConceicao"><img src="https://avatars.githubusercontent.com/u/13354592?v=4?s=100" width="100px;" alt="Fabio"/><br /><sub><b>Fabio</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=FabioConceicao" title="Code">💻</a></td>
  198. </tr>
  199. <tr>
  200. <td align="center" valign="top" width="14.28%"><a href="http://forann.eu"><img src="https://avatars.githubusercontent.com/u/12081628?v=4?s=100" width="100px;" alt="Piotr"/><br /><sub><b>Piotr</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=PiotrZub" title="Code">💻</a></td>
  201. <td align="center" valign="top" width="14.28%"><a href="https://mat2095.de"><img src="https://avatars.githubusercontent.com/u/11258252?v=4?s=100" width="100px;" alt="Matthias Bay"/><br /><sub><b>Matthias Bay</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=Mat2095" title="Code">💻</a></td>
  202. <td align="center" valign="top" width="14.28%"><a href="https://github.com/sannysanoff"><img src="https://avatars.githubusercontent.com/u/952071?v=4?s=100" width="100px;" alt="Sanny Sanoff"/><br /><sub><b>Sanny Sanoff</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=sannysanoff" title="Code">💻</a></td>
  203. <td align="center" valign="top" width="14.28%"><a href="https://github.com/McSym28"><img src="https://avatars.githubusercontent.com/u/8185872?v=4?s=100" width="100px;" alt="McSym28"/><br /><sub><b>McSym28</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=McSym28" title="Code">💻</a></td>
  204. <td align="center" valign="top" width="14.28%"><a href="https://ericleong.me"><img src="https://avatars.githubusercontent.com/u/1572011?v=4?s=100" width="100px;" alt="Eric Leong"/><br /><sub><b>Eric Leong</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=ericleong" title="Code">💻</a></td>
  205. <td align="center" valign="top" width="14.28%"><a href="https://davidday.tw/"><img src="https://avatars.githubusercontent.com/u/47077427?v=4?s=100" width="100px;" alt="David Day"/><br /><sub><b>David Day</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=dj6082013" title="Code">💻</a></td>
  206. <td align="center" valign="top" width="14.28%"><a href="https://github.com/Rocketeer007"><img src="https://avatars.githubusercontent.com/u/11492464?v=4?s=100" width="100px;" alt="Nick Price"/><br /><sub><b>Nick Price</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=Rocketeer007" title="Code">💻</a></td>
  207. </tr>
  208. <tr>
  209. <td align="center" valign="top" width="14.28%"><a href="https://github.com/ahnafbinazad"><img src="https://avatars.githubusercontent.com/u/66205903?v=4?s=100" width="100px;" alt="Ahnaf Bin Azad"/><br /><sub><b>Ahnaf Bin Azad</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=ahnafbinazad" title="Code">💻</a></td>
  210. <td align="center" valign="top" width="14.28%"><a href="https://github.com/OctavioAnino"><img src="https://avatars.githubusercontent.com/u/114261436?v=4?s=100" width="100px;" alt="Octavio E Anino"/><br /><sub><b>Octavio E Anino</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=OctavioAnino" title="Code">💻</a></td>
  211. <td align="center" valign="top" width="14.28%"><a href="http://linktr.ee/yashpimple"><img src="https://avatars.githubusercontent.com/u/97302447?v=4?s=100" width="100px;" alt="Yash Pimple"/><br /><sub><b>Yash Pimple</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=YashPimple" title="Code">💻</a></td>
  212. <td align="center" valign="top" width="14.28%"><a href="https://github.com/Wninayyds"><img src="https://avatars.githubusercontent.com/u/90488923?v=4?s=100" width="100px;" alt="Nina"/><br /><sub><b>Nina</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=Wninayyds" title="Code">💻</a></td>
  213. <td align="center" valign="top" width="14.28%"><a href="https://github.com/FercueNat"><img src="https://avatars.githubusercontent.com/u/113535859?v=4?s=100" width="100px;" alt="FercueNat"/><br /><sub><b>FercueNat</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=FercueNat" title="Code">💻</a></td>
  214. <td align="center" valign="top" width="14.28%"><a href="https://github.com/ImmediandoSrl"><img src="https://avatars.githubusercontent.com/u/172423330?v=4?s=100" width="100px;" alt="ImmediandoSrl"/><br /><sub><b>ImmediandoSrl</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=ImmediandoSrl" title="Code">💻</a></td>
  215. <td align="center" valign="top" width="14.28%"><a href="https://github.com/davideprimasc"><img src="https://avatars.githubusercontent.com/u/159039808?v=4?s=100" width="100px;" alt="davideprimasc"/><br /><sub><b>davideprimasc</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=davideprimasc" title="Code">💻</a></td>
  216. </tr>
  217. <tr>
  218. <td align="center" valign="top" width="14.28%"><a href="https://github.com/DB107"><img src="https://avatars.githubusercontent.com/u/154587979?v=4?s=100" width="100px;" alt="DB107"/><br /><sub><b>DB107</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=DB107" title="Code">💻</a></td>
  219. <td align="center" valign="top" width="14.28%"><a href="https://speakerdeck.com/eltociear"><img src="https://avatars.githubusercontent.com/u/22633385?v=4?s=100" width="100px;" alt="Ikko Eltociear Ashimine"/><br /><sub><b>Ikko Eltociear Ashimine</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=eltociear" title="Documentation">📖</a></td>
  220. <td align="center" valign="top" width="14.28%"><a href="https://github.com/SamC1832js"><img src="https://avatars.githubusercontent.com/u/79888848?v=4?s=100" width="100px;" alt="Sam C"/><br /><sub><b>Sam C</b></sub></a><br /><a href="https://github.com/codenameone/CodenameOne/commits?author=SamC1832js" title="Code">💻</a></td>
  221. </tr>
  222. </tbody>
  223. </table>
  224. <!-- markdownlint-restore -->
  225. <!-- prettier-ignore-end -->
  226. <!-- ALL-CONTRIBUTORS-LIST:END -->
  227. This historical list recognizes people who contributed code and documentation before outside pull requests were disabled. Current participation happens through [issues and discussions](CONTRIBUTING.md).
scripts/agent-kit/bootstrap/create-app.sh · Bundled script · 155 lines · 1 finding marked
  1. #!/usr/bin/env bash
  2. #
  3. # Copyright (c) 2026, Codename One and/or its affiliates. All rights reserved.
  4. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5. # This code is free software; you can redistribute it and/or modify it
  6. # under the terms of the GNU General Public License version 2 only, as
  7. # published by the Free Software Foundation. Codename One designates this
  8. # particular file as subject to the "Classpath" exception as provided
  9. # by Oracle in the LICENSE file that accompanied this code.
  10. #
  11. # Create a Codename One project from a shell, with nothing installed first.
  12. #
  13. # curl -fsSL https://www.codenameone.com/agents/create-app.sh | bash -s -- \
    • Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
    • Line 13 on GitHub
  14. # --name HabitTracker --package com.acme.habits [--template BAREBONES] ...
  15. # create-app.sh --list # the templates, one line each
  16. # create-app.sh --jdk-only # just make sure a JDK 17+ exists, print JAVA_HOME
  17. #
  18. # Every option after the script's own is passed to CreateProject, which is the
  19. # start.codenameone.com generator as a command; see `--help`.
  20. #
  21. # What it does, and nothing else:
  22. # 1. Finds a JDK 17 or newer (JAVA_HOME, then java on PATH). When there is
  23. # none, downloads a Temurin 17 JDK from api.adoptium.net into
  24. # $CN1_AGENT_HOME/jdk (default ~/.codenameone/agent). No admin rights, no
  25. # system-wide change.
  26. # 2. Downloads the generator (cn1-create.jar) and the two Codename One jars it
  27. # runs against into $CN1_AGENT_HOME, once per release.
  28. # 3. Runs it. The project it writes carries its own Maven wrapper, so no Maven
  29. # install is needed either.
  30. #
  31. # The last line printed on success is `JAVA_HOME=<path>`: export it before
  32. # running ./mvnw in the new project.
  33. set -euo pipefail
  34. SITE="${CN1_AGENT_SITE:-https://www.codenameone.com/agents}"
  35. REPO="${CN1_MAVEN_REPO:-https://repo.codenameone.com/maven2}"
  36. HOME_DIR="${CN1_AGENT_HOME:-$HOME/.codenameone/agent}"
  37. export CN1_TELEMETRY="${CN1_TELEMETRY:-0}"
  38. say() { echo "create-app: $*" >&2; }
  39. die() { say "$*"; exit 1; }
  40. case "$(uname -s)" in
  41. MINGW*|MSYS*|CYGWIN*)
  42. # Git Bash: java wants Windows paths and ';' between class path entries.
  43. die "on Windows run create-app.ps1 from PowerShell (see https://www.codenameone.com/agents/)" ;;
  44. esac
  45. java_major() {
  46. # Prints the major version of the java at $1, or nothing.
  47. "$1" -version 2>&1 | sed -n 's/.*version "\([0-9]*\)[."].*/\1/p' | head -n1
  48. }
  49. find_jdk() {
  50. local candidates=()
  51. [ -n "${JAVA_HOME:-}" ] && candidates+=("$JAVA_HOME")
  52. if command -v java >/dev/null 2>&1; then
  53. local j; j="$(command -v java)"
  54. # Resolve symlinks (macOS /usr/bin/java is a stub; java_home knows the real one).
  55. if [ "$(uname -s)" = Darwin ] && /usr/libexec/java_home -v 17+ >/dev/null 2>&1; then
  56. candidates+=("$(/usr/libexec/java_home -v 17+)")
  57. fi
  58. candidates+=("$(cd "$(dirname "$j")/.." && pwd)")
  59. fi
  60. [ -d "$HOME_DIR/jdk" ] && for d in "$HOME_DIR"/jdk/*/; do
  61. [ -x "$d/bin/java" ] && candidates+=("${d%/}")
  62. [ -x "$d/Contents/Home/bin/java" ] && candidates+=("${d%/}/Contents/Home")
  63. done
  64. local c m
  65. for c in "${candidates[@]}"; do
  66. [ -x "$c/bin/java" ] && [ -x "$c/bin/javac" ] || continue
  67. m="$(java_major "$c/bin/java")"
  68. if [ -n "$m" ] && [ "$m" -ge 17 ] 2>/dev/null; then echo "$c"; return 0; fi
  69. done
  70. return 1
  71. }
  72. download_jdk() {
  73. local os arch
  74. case "$(uname -s)" in
  75. Darwin) os=mac ;;
  76. Linux) os=linux ;;
  77. *) die "unsupported OS $(uname -s); on Windows run create-app.ps1" ;;
  78. esac
  79. case "$(uname -m)" in
  80. x86_64|amd64) arch=x64 ;;
  81. arm64|aarch64) arch=aarch64 ;;
  82. *) die "unsupported CPU $(uname -m)" ;;
  83. esac
  84. local url="https://api.adoptium.net/v3/binary/latest/17/ga/$os/$arch/jdk/hotspot/normal/eclipse"
  85. say "no JDK 17+ found; downloading Temurin 17 for $os/$arch into $HOME_DIR/jdk"
  86. mkdir -p "$HOME_DIR/jdk"
  87. local tmp; tmp="$(mktemp "$HOME_DIR/jdk/download.XXXXXX")"
  88. curl -fsSL "$url" -o "$tmp" || die "JDK download failed from $url"
  89. tar -xzf "$tmp" -C "$HOME_DIR/jdk" || die "could not unpack the JDK"
  90. rm -f "$tmp"
  91. }
  92. JDK="$(find_jdk || true)"
  93. if [ -z "$JDK" ]; then
  94. download_jdk
  95. JDK="$(find_jdk || true)"
  96. [ -n "$JDK" ] || die "downloaded a JDK but could not find bin/java in $HOME_DIR/jdk"
  97. fi
  98. say "using JDK at $JDK"
  99. if [ "${1:-}" = "--jdk-only" ]; then
  100. echo "JAVA_HOME=$JDK"
  101. exit 0
  102. fi
  103. mkdir -p "$HOME_DIR"
  104. curl -fsSL "$SITE/cn1-create.properties" -o "$HOME_DIR/cn1-create.properties.new" \
  105. || die "could not read $SITE/cn1-create.properties"
  106. VERSION="$(sed -n 's/^cn1.version=//p' "$HOME_DIR/cn1-create.properties.new")"
  107. [ -n "$VERSION" ] || die "no cn1.version in $SITE/cn1-create.properties"
  108. KIT="$(sed -n 's/^kit.build=//p' "$HOME_DIR/cn1-create.properties.new")"
  109. LIB="$HOME_DIR/lib/$VERSION-${KIT:-0}"
  110. if [ ! -f "$LIB/.complete" ]; then
  111. say "downloading the project generator for Codename One $VERSION"
  112. mkdir -p "$LIB"
  113. curl -fsSL "$SITE/cn1-create.jar" -o "$LIB/cn1-create.jar"
  114. for a in codenameone-core codenameone-javase; do
  115. curl -fsSL "$REPO/com/codenameone/$a/$VERSION/$a-$VERSION.jar" -o "$LIB/$a.jar"
  116. done
  117. touch "$LIB/.complete"
  118. fi
  119. # A complete-app template is its own download (templates/<name>.jar), fetched
  120. # only when asked for and cached under its own hash.
  121. CP="$LIB/cn1-create.jar:$LIB/codenameone-core.jar:$LIB/codenameone-javase.jar"
  122. TEMPLATE=""
  123. prev=""
  124. for a in "$@"; do
  125. [ "$prev" = "--template" ] && TEMPLATE="$(printf '%s' "$a" | tr '[:upper:]' '[:lower:]')"
  126. prev="$a"
  127. done
  128. if [ -n "$TEMPLATE" ]; then
  129. THASH="$(sed -n "s/^template\.$TEMPLATE=//p" "$HOME_DIR/cn1-create.properties.new")"
  130. if [ -n "$THASH" ]; then
  131. TJAR="$HOME_DIR/templates/$TEMPLATE-$THASH.jar"
  132. if [ ! -f "$TJAR" ]; then
  133. say "downloading the $TEMPLATE template"
  134. mkdir -p "$HOME_DIR/templates"
  135. curl -fsSL "$SITE/templates/$TEMPLATE.jar" -o "$TJAR.part" || die "could not download $SITE/templates/$TEMPLATE.jar"
  136. mv -f "$TJAR.part" "$TJAR"
  137. fi
  138. CP="$CP:$TJAR"
  139. fi
  140. fi
  141. mv -f "$HOME_DIR/cn1-create.properties.new" "$HOME_DIR/cn1-create.properties"
  142. "$JDK/bin/java" -Djava.awt.headless=true -cp "$CP" \
  143. com.codename1.initializr.model.CreateProject "$@"
  144. echo "JAVA_HOME=$JDK"

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.