Open Mcdostone opened 3 months ago
Hi @Mcdostone, thanks for the feature request!
I think it may even make sense to support JAVA_TOOL_OPTIONS
in a native executable for compatibility. After all, the native executable should behave the same as the application running on HotSpot. A native executable even includes a JVM (called SubstrateVM).
Note that there already is a NATIVE_IMAGE_OPTIONS
env var which you can use to inject arguments into the bin/native-image
launcher, but that is for build time.
Feature request
Is your feature request related to a problem? Please describe.
This feature is about run time, not build time. When deploying a java app, we can configure the JVM with the
JAVA_TOOL_OPTIONS
environment variable or by passing arguments to the command.In the graalVM world, it is also possible to declare system properties at run time by passing arguments to the native executable:
./my-native-executable -D hello=world
. Unfortunately, I was not able to find any similar environment variable asJAVA_TOOL_OPTIONS
for native executables.Describe the solution you'd like.
It would be interesting to define an environment variable that is automatically read by the native executable. I have no inspiration for the name though:
GRAALVM_TOOL_OPTIONS="-D hello=world" ./my-native-executable
.Describe who do you think will benefit the most.
This feature could benefit people shipping native executables in containers. Indeed, It is pretty common to configure applications with environment variables.
Describe alternatives you've considered.
So far, the only way to define system properties at run time is to declare them as arguments of the command line:
Additional context.
This issue is related to #4650. The last message of this issue suggests that
JAVA_TOOL_OPTIONS
should be "compatible" with graalVM. I did some tests with different environment variables here and it's not the case. It might be a normal behavior or a bug, I don't know to be honest.Why do I suggest this feature? I have a spring boot native executable running on kubernetes. this application needs a specific trust store to communicate with other applications. The trust store is automatically mounted to the pod by kubernetes at boot time, which means I need to configure my application to use it (
-Djavax.net.ssl.trustStore
).Express whether you'd like to help contributing this feature
If I could, yes !