Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for all kinds of JVM args via .scala-jvmopts file and JAVA_OPTS env var, not only java properties #2841

Open
nehaev opened this issue Apr 7, 2024 · 1 comment
Labels
Community help wanted Issues that idicate features that are nice-to-have but core team does not have time to work on it enhancement New feature or request UX

Comments

@nehaev
Copy link

nehaev commented Apr 7, 2024

Describe what needs to be done and why
I'm trying to run a local Spark job as a shebang script. On modern JDKs, Spark requires certain args to be provided to JVM (e.g., --add-exports java.base/sun.nio.ch=ALL-UNNAMED). The current implementation of scala-cli can only propagate java properties (using JAVA_OPTS or .scala-jvmopts), but not other vm args. I receive the following warning:

Warning: Only java properties are supported in .scala-jvmopts file. Other options are ignored: --add-exports java.base/sun.nio.ch=ALL-UNNAMED

It's not the case for sbt, for example, as it supports such kind of args both in JAVA_OPTS and in .jvmopts file.

Describe alternatives you've considered
I've considered scala-cli --power run --spark-standalone, it starts to download JDK 8, but it's not what I want.

It's not about running Spark at all costs, or inability to downgrade JVM. I believe scala-cli should be able to propagate all kinds of args to JVM.

@Gedochao
Copy link
Contributor

Gedochao commented Apr 9, 2024

JVM args other than Java properties indeed aren't supported in the JAVA_OPTS env at the moment, as well as in the .scala-jvmopts file.

A warning was missing for when invalid JVM args are being passed in the env vars, I linked a quick fix PR (I just add the missing warning, so it doesn't solve this feature request).

Java options can instead be passed via command line options, check the relevant doc.

scala-cli . --java-opt --add-exports --java-opt java.base/sun.nio.ch=ALL-UNNAMED

@Gedochao Gedochao added enhancement New feature or request UX labels Apr 9, 2024
@Gedochao Gedochao removed their assignment Apr 9, 2024
@Gedochao Gedochao added the Community help wanted Issues that idicate features that are nice-to-have but core team does not have time to work on it label Apr 9, 2024
@Gedochao Gedochao changed the title Support all kinds of JVM args, not only java properties Add support for all kinds of JVM args via .scala-jvmopts file and JAVA_OPTS env var, not only java properties Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community help wanted Issues that idicate features that are nice-to-have but core team does not have time to work on it enhancement New feature or request UX
Projects
None yet
Development

No branches or pull requests

2 participants