Skip to content

fix: pass system properties to native images - #2650

Open
jmini wants to merge 1 commit into
jbangdev:mainfrom
jmini:issue-2649
Open

fix: pass system properties to native images#2650
jmini wants to merge 1 commit into
jbangdev:mainfrom
jmini:issue-2649

Conversation

@jmini

@jmini jmini commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #2649

A script run with --native never saw the -D properties given to JBang.
NativeCmdGenerator emitted only the image path and the user's arguments,
and NativeBuildStep does not hand them to native-image either, so nothing
was baked in at build time as a fallback. The properties were still applied
while building - for directive substitution and dependency resolution - so
jbang --native -Dfoo=bar could visibly change which dependencies were
resolved and then vanish before main() ran, without a warning.

A native image accepts -Dkey=value at run time just like a JVM does, so the
flags can simply be passed to the binary. Properties from -D and from a
//RUNTIME_OPTIONS directive are now forwarded.

Other runtime options are deliberately not forwarded, because a native image
treats them very differently: an unknown -XX: flag makes the binary exit with
"Could not find option", and options the image runtime does not recognise at
all (-agentlib:, -verbose:gc, ...) stay in the argument list and arrive as
program arguments. Since dropping them silently is what made this hard to
diagnose, JBang now warns instead.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • ai-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d664c797-0acd-43d0-a2c1-53cd76104c2a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

📦 PR Build Available

Install this PR build:

curl -sL https://github.com/jbangdev/jbang-pr-builds/releases/download/pr-2650/jbang.tar | tar xf - && ./jbang/bin/jbang version

Release
| Built from 38b58d1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: jbang --native silently drops -D properties and runtime options

1 participant