Skip to content

[3.0] Client fails to start with ExceptionInInitializerError when JAVA_HOME is unset #887

Description

@jbachorik

Summary

The CLI fails to start with ExceptionInInitializerError when JAVA_HOME is unset, because a static initializer dereferences the environment variable without a null check.

Surfaced during the pre-release client review.

Ground truth (verified)

btrace-client Main.java:96:

Paths.get(System.getenv("JAVA_HOME"), ...)

When JAVA_HOME is unset, System.getenv returns null, Paths.get(null, ...) throws NullPointerException inside the static initializer. Only IOException is caught, so the NPE escapes as ExceptionInInitializerError and the CLI never starts.

Fix

Guard for a null/blank JAVA_HOME (fall back to java.home system property or emit a clear diagnostic instructing the user to set JAVA_HOME), and broaden the catch to cover the null case.

Severity: MAJOR (CLI unusable in environments without JAVA_HOME). Owner: client team.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions