Skip to main content
When NSP attaches to a Java application, you access it through the standard Session interface — get_str, get_int, get_bool, and execute() all work exactly as they do for other runtimes. When you need to go further — reading a specific Java field or invoking a method by class name — session.jvm gives you a JVMSessionProxy with those primitives.

Detecting JVM apps

Filter the list_apps() results by runtime == "jvm" to identify Java processes.

Attaching to a JVM app

Attach by display name, just like any other runtime.

Reading state with standard accessors

The same flat dot-notation key-value map that NSP exposes for V8 and CLR apps is also available for JVM apps. Java object fields are normalized into SSF keys automatically.
Retrieve everything under a prefix to inspect the full namespace:

Reading fields directly with session.jvm

session.jvm gives you read_field() for fetching a specific Java class field by fully-qualified class name. The value is returned as a native Python type.

Invoking Java methods

Use session.jvm.invoke() to call a Java method on the live process. Python values are coerced to JVM types based on the method’s declared signature.
The raw_return field in the ActionResponse carries the JVM return value when an action maps to a method invocation. Inspect it to confirm what the method returned.

Enumerating loaded classes

Use session.jvm.list_classes() to discover which classes are loaded in the target JVM. Filter by package prefix to narrow the results.

Type coercion reference

Cold probe timing

The first time NSP attaches to a JVM process, the initial probe can take 10 to 90 seconds. During this time probe_status reads "attaching" or "cold_probe". Wait for "active" before executing actions or reading fields.
After the initial attachment, JVM apps operate at a confidence range of 0.93–0.97. Call await session.refresh(fresh_probe=True) immediately after attaching to confirm the first snapshot is ready before issuing commands.

Complete example: ArduPilot telemetry monitor

ardupilot_monitor.py