AthenaStudioAthenaStudio is a Visual Studio Code extension for Athena2ME — a JavaScript runtime on J2ME / MIDP. It gives you editor tooling, a browser-based simulator for rapid iteration, and JAR / JAD export so you can package what you build in Table of contents
Features
Requirements
InstallationFrom a
|
| Command ID | Title (palette) | Purpose |
|---|---|---|
athenastudio.openSimulator |
Open J2ME Simulator | Create or focus the simulator webview panel. |
athenastudio.exportJar |
Export JAR (use outputDir setting) | Prompt for basename; write .jar / .jad under configured athenastudio.outputDir (default dist/). |
athenastudio.exportJarBuild |
Export JAR to workspace build/ | Same pipeline, fixed output under build/. |
athenastudio.selectScreenPreset |
AthenaStudio: Select Screen Preset | Pick a preset from targets/j2me.json and update workspace screenPresetId / dimensions. |
athenastudio.installTypes |
AthenaStudio: Install J2ME Types into Workspace | Copy athenastudio-j2me.d.ts and j2me-api.json into .athenastudio/; refresh jsconfig.json merge. |
athenastudio.browseJ2meApi |
AthenaStudio: Browse J2ME Native API List | Searchable list of native ids from targets/j2me-api.json; copies selection to clipboard. |
Editor integration: Open J2ME Simulator and Export JAR to workspace build/ appear in the editor title bar and explorer context menu when main.js is the active resource.
Settings
| Key | Default | Description |
|---|---|---|
athenastudio.resFolder |
res |
Resource root (main.js, boot.ini, images, lib/…). Files map to JAR paths: res/foo → /foo. |
athenastudio.outputDir |
dist |
Output folder for Export JAR (use outputDir setting). |
athenastudio.outputJarBasename |
project |
Default basename for the export prompt (<name>.jar / <name>.jad). |
athenastudio.templateJar |
(empty) | Local template .jar path (absolute or workspace-relative). If set and valid, overrides download URL. |
athenastudio.templateJad |
(empty) | Local template .jad; must exist when set. |
athenastudio.templateJarDownloadUrl |
(empty) | HTTPS URL for template JAR when templateJar is empty; cached under templateCacheDir. |
athenastudio.templateJadDownloadUrl |
(empty) | HTTPS URL for template JAD when needed. |
athenastudio.templateCacheDir |
.athenastudio/template |
Workspace-relative cache for downloaded templates. |
athenastudio.screenPresetId |
240x320 |
Preset id from targets/j2me.json (or custom). |
athenastudio.screenWidth / screenHeight |
240 / 320 |
Used when preset is custom. |
athenastudio.simulatorBesidePreserveEditorFocus |
true |
When opening the simulator, keep focus in the text editor (useful while editing boot.ini). |
Simulator
Runner tab
- Runs your
res/main.jsin a stubbed environment that mirrors core Athena2ME globals (Screen,Draw,Pad,Keyboard,Color,Font,Image,os,Request, sockets,Timer,Sound,require, etc.). - The webview receives
init.j2meApi(fromtargets/j2me-api.json): the canonical list of native binding names. DevTools can usewindow.__ATHENA_J2ME_NATIVES__(string array) for tooling; the status strip shows the native count. - Boot splash is driven by
res/boot.ini(parsed to match device behaviour). - Reload re-reads the workspace
res/tree and restarts the boot + main flow.
Boot tab
- Visual editor for splash slides, tick rate, handoff, and related fields; changes are written to
res/boot.ini(with debouncing / echo suppression so editor focus is preserved). - Opening the Boot tab can open
boot.iniin the text editor; switching back to Runner may close that tab if it was opened from the simulator (extension behaviour).
Panel lifecycle
- The simulator uses a webview panel serializer: after a window reload, VS Code can restore the panel without losing the extension’s internal wiring.
deactivateintentionally does not dispose the panel so serialization can complete correctly.
Content Security Policy
- The webview HTML sets a strict CSP (scripts with nonce +
webview.cspSource). Local scripts live undermedia/and are exposed viaasWebviewUri.
Type definitions & IntelliSense
On activation (with a workspace folder):
- The extension writes
.athenastudio/athenastudio-j2me.d.ts(copy oftypes/athenastudio-j2me.d.tsfrom the package) and.athenastudio/j2me-api.json(copy oftargets/j2me-api.json) when present. - It merges
jsconfig.jsonat the workspace root to:- reference that
.d.ts - include
res/**/*.jswhen missing
- reference that
Run Install J2ME Types into Workspace to repeat this manually and see a confirmation message.
Snippets
Contributed for language: javascript from snippets/j2me.json, including:
- Frame loop with
os.startFrameLoop/Screen.clear requirefor JAR-root modulesRequest.getPromise examplePad.addListener(JUST_PRESSED)
Export (JAR / JAD)
- Template — A base Athena2ME JAR (and optional JAD) from local paths or downloaded URLs (see settings).
- Packaging — The extension replaces embedded
resentries with files from your workspaceresFolder, injects updatedmain.js/boot.ini/ assets, and adjusts JAD size fields. - Outputs — Either
dist/(configurable) orbuild/depending on the command.
Ensure templateJar points to a valid file or configure a reachable templateJarDownloadUrl.
Project layout
Typical Athena2ME app (sibling of this folder in the repo):
res/
main.js # Entry script (required for simulator discovery)
boot.ini # Boot splash config
lib/ # Optional CommonJS modules (require("/lib/..."))
.athenastudio/ # Created by the extension (types, template cache)
build/ # Output of “Export JAR to workspace build/”
dist/ # Output of “Export JAR (use outputDir setting)”
jsconfig.json # Optional; extension merges types + include
This repository folder (athenastudio/)
athenastudio/
src/ # TypeScript extension sources
dist/ # Compiled JS (extension entry: dist/extension.js)
media/ # Webview assets (simulator.js, bootIni.js, vendor/*)
types/ # athenastudio-j2me.d.ts (shipped + copied to workspace)
targets/ # j2me.json (presets) + j2me-api.json (native list from Athena2ME.java)
snippets/ # j2me.json snippets
scripts/ # sync-j2me-api, check-dts-coverage, extract-natives
package.json
README.md # This file
J2ME API manifest (sync from Athena2ME)
AthenaStudio keeps a machine-readable list of JS native bindings in targets/j2me-api.json. It is generated from NativeFunctionListEntry("…") strings in Athena2ME.java so the extension (and CI) can stay aligned with the runtime without hand-maintaining that list.
targets/j2me.json references the manifest via "nativeManifest": "j2me-api.json".
Regenerating the manifest
From the athenastudio folder, with a checkout of Athena2ME available:
| Method | Command / env |
|---|---|
| Sibling layout (default) | npm run sync-j2me-api — looks for ../src/Athena2ME.java relative to athenastudio/. |
| Separate clone | Set ATHENA2ME_ROOT to the Athena2ME repo root, then npm run sync-j2me-api. |
| Explicit path | node scripts/sync-j2me-api.mjs C:\path\to\Athena2ME or …\Athena2ME.java. |
If Athena2ME.java is not found (e.g. extension-only repo), the script exits 0 and does not overwrite j2me-api.json, so vscode:prepublish / installs keep working. Commit an up-to-date j2me-api.json whenever you release against a new runtime.
Verifying TypeScript coverage
Hand-written types/athenastudio-j2me.d.ts should reflect those natives. Run:
npm run verify-api
This runs sync-j2me-api then check-dts-coverage (heuristic checks + a small map for odd names like Screen.Layer.ctor). Use it in CI before publishing when Java is available.
Legacy one-off extract
npm run extract-natives
Writes natives-extracted.json (gitignored) — prefer targets/j2me-api.json for anything that should ship with the extension.
Development
Prerequisites
- Node.js (LTS recommended)
- VS Code
Build
cd athenastudio
npm install
npm run compile
Watch mode
npm run watch
Run the extension
- Open the
athenastudiofolder in VS Code. - Run and Debug → Launch Extension (see
.vscode/launch.json). - In the [Extension Development Host] window, File → Open Folder… and open an Athena2ME project (with
res/main.js), not only the extension repo — otherwise the simulator will not find game files.
GitHub Actions (split-repo layout)
Workflow: .github/workflows/ci.yml.
- On push / pull_request: checks out Athena2ME (public repo
DanielSant0s/Athena2MEby default), runssync-j2me-api,check-dts-coverage, andcompile. - Override the runtime repo or ref with Variables
ATHENA2ME_GITHUB_REPOSITORYandATHENA2ME_REF. For a private Athena2ME fork, set SecretATHENA2ME_CHECKOUT_TOKEN(read access). - Tag
v*(push): builds a VSIX and attaches it to the GitHub Release (viasoftprops/action-gh-release).
The workflow updates targets/j2me-api.json during the job (not necessarily committed); the packaged VSIX always contains the manifest synced from the pinned Athena2ME ref.
Packaging
Use vsce package (or your CI) after npm run compile. The published extension ships dist/, media/, targets/ (including j2me-api.json), and types/ (see .vscodeignore — TypeScript sources under src/ are not bundled into the VSIX).
For local releases aligned with a new Athena2ME version, run npm run verify-api with the Java checkout available, then commit the updated j2me-api.json and any .d.ts fixes if you want the repo snapshot to match.
License
MIT — see package.json (license field).
See also
- Athena2ME main project README (parent repo): runtime capabilities,
boot.iniformat, and device deployment. - Issues / contributions: use the upstream Athena2ME / AthenaStudio project trackers as applicable.