We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Repro:
public class Env { public static String FOO = System.getenv("FOO"); public static void main(String [] args) { System.out.println("FOO at build time: " + FOO); } }
Compile with CE 22.3.1 and run FOO=1 $GRAALVM_HOME/bin/native-image --initialize-at-build-time=Env Env Running the binary ./env produces:
FOO=1 $GRAALVM_HOME/bin/native-image --initialize-at-build-time=Env Env
./env
$ ./env FOO at build time: 1
However with Oracle GraalVM 21:
$ ./env FOO at build time: null
The text was updated successfully, but these errors were encountered:
Hi @borkdude, starting with GraalVM 23.0.0 you need to explicitly define which env variables should get embedded in the native image using the -E option.
-E
The following will do the trick in your example:
$ FOO=1 native-image --initialize-at-build-time=Env Env -EFOO ... $ ./env FOO at build time: 1
Sorry, something went wrong.
@zakkak Thanks!
No branches or pull requests
Repro:
Compile with CE 22.3.1 and run
FOO=1 $GRAALVM_HOME/bin/native-image --initialize-at-build-time=Env Env
Running the binary
./env
produces:However with Oracle GraalVM 21:
The text was updated successfully, but these errors were encountered: