Skip to content

Development

Danny Thomas edited this page Sep 17, 2026 · 1 revision

Development

Compile and run

Compile the selected modules and their dependencies:

ja compile

compile reports retained and fresh compilation diagnostics. Other commands compile source modules silently as needed. Use ja compile --recompile to compile without reusing prior output.

Pass --verbose before the command to log resolution and each tool or Java invocation to standard error. The switch is also passed to each underlying tool that supports it:

ja --verbose compile

Run the application, optionally passing it arguments:

ja run
ja run one two three

When several application modules are available, choose one with -m or --module:

ja run -m com.example.application one two three

To run a class other than the module's declared entry point, add its name after /:

ja run --module com.example.application/com.example.application.Alternate

Run tests

First, add JUnit to the module containing the tests. This is a one-time setup step:

ja require --static org.junit.jupiter

The requirement activates the test runner, so tests can then be run directly:

ja test
ja test com.example.application.ApplicationTest
ja test com.example.application.ApplicationTest.starts
ja test --all
ja test -t fast
ja test --tag fast --tag unit

Use an ordinary ja require org.junit.jupiter instead for a dedicated test module. The resolved root modules define the test discovery scope. Name one or more classes or methods to select them.

A bare ja test discovers tests in the resolved root modules and reuses successful ordinary Jupiter @Test methods while their test classes, reachable code, and module inputs are unchanged. Parameterized, repeated, dynamic, template, and other tests execute on every run.

--all runs all tests without reuse. Explicit selectors, -t, and --tag run the selected tests without reuse; either tag option may be repeated. Use the standalone junit tool for other Console options. The summary distinguishes JUnit containers and tests from test methods satisfied by the cache.

Test runner output uses a compact summary by default and includes failure details when tests fail. Standard output and error produced by tests are captured in structured reports instead of written to the console; reports from failed runs are retained and linked from the failure output.

Run benchmarks

First, add JMH to the module containing the benchmarks. This is a one-time setup step:

ja require --static org.openjdk.jmh.core

The requirement activates the benchmark runner:

ja bench
ja bench com.example.application.ApplicationBenchmark
ja bench com.example.application.ApplicationBenchmark.starts

Use an ordinary ja require org.openjdk.jmh.core instead for a dedicated benchmark module. The tool discovers benchmarks from activated root modules, generates the benchmark harness, and runs it without requiring a separate generated-source build. Name one or more classes or methods to select them. Use ja tool jmh for additional options and native selector syntax.

Format source

Format source in the selected modules:

ja fmt

Explore APIs

Look up APIs from the selected modules, their dependencies, and the JDK without leaving the terminal:

ja doc java.lang.String.isEmpty

Show the source appropriate to a symbol. Top-level types show their complete source file, nested types and methods show their definitions, and other declarations show their signatures:

ja source java.lang.String.isEmpty

When attached source is unavailable, the command warns and shows the compiled declaration instead.

Open the complete API documentation in a browser, optionally starting at a particular type:

ja doc --browse
ja doc --browse java.lang.String

Clone this wiki locally