Skip to content

[2.x] fix: Handle -X JVM options on command line#8566

Merged
eed3si9n merged 2 commits intosbt:developfrom
GlobalStar117:fix/command-line-jvm-options
Jan 17, 2026
Merged

[2.x] fix: Handle -X JVM options on command line#8566
eed3si9n merged 2 commits intosbt:developfrom
GlobalStar117:fix/command-line-jvm-options

Conversation

@GlobalStar117
Copy link
Copy Markdown
Contributor

Summary

Fixes #5742

Previously, passing JVM options like -Xmx1G directly on the command line would result in an error:

sbt -v -Xmx1G
[error] Expected ';'
[error] -Xmx1G
[error]       ^

This was because -X options were being passed to sbt as commands instead of being recognized as JVM arguments.

Changes

  • Added handling for -X options in sbt.bat to pass them to the JVM via :addJava
  • Updated help text to document this feature:
    -X<flag>            pass -X<flag> directly to the java runtime
                        (e.g., -Xmx1G, -Xms512M, -Xss4M)
    
  • Added integration tests for the new functionality

Testing

With this fix:

sbt -v -Xmx1G
# Executing command line:
# ... -Xmx1G ...

The -Xmx1G is now correctly passed to the JVM.


This is a Gittensor contribution.
gittensor:user:GlobalStar117

GlobalStar117 and others added 2 commits January 17, 2026 02:54
This is a Gittensor contribution.

Previously, passing JVM options like -Xmx1G directly on the command
line would result in an error:

  sbt -v -Xmx1G
  [error] Expected ';'
  [error] -Xmx1G
  [error]       ^

This was because -X options were being passed to sbt as commands
instead of being recognized as JVM arguments.

Changes:
- Added handling for -X options in sbt.bat to pass them to the JVM
- Updated help text to document this feature
- Added integration tests for the new functionality
Copy link
Copy Markdown
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@eed3si9n eed3si9n merged commit 1efebea into sbt:develop Jan 17, 2026
14 checks passed
eed3si9n pushed a commit to eed3si9n/sbt that referenced this pull request Jan 17, 2026
Previously, passing JVM options like -Xmx1G directly on the command
line would result in an error:

  sbt -v -Xmx1G
  [error] Expected ';'
  [error] -Xmx1G
  [error]       ^

This was because -X options were being passed to sbt as commands
instead of being recognized as JVM arguments.

Changes:
- Added handling for -X options in sbt.bat to pass them to the JVM
- Updated help text to document this feature
- Added integration tests for the new functionality
@eed3si9n eed3si9n added this to the 1.12.1 milestone Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sbt -v -Xmx1G should work

2 participants