I have been playing around with all different ways to set environment variables in my setup and am struggling to get any to show when running System.getenv()
apart from when I explicitly execute export VARIABLENAME=secretValue
in the terminal right before running the project.
I’ve tried;
- VSCode’s
launch.json
, - creating an
.env
file, - setting envrionment variables in windows,
- using the Maven VSCode extension settings config variables,
- editing
.profile
, - editing
.bash_profile
But I just can’t seem to get something that isn’t the inline entry being picked up in my Hilla runtime after executing ./mvnw
…
How can I set environment variables that actually work where I can set them at a project level and without resetting them in my terminal manually every time? Assumedly I shouldn’t be editing the ./mvnw
script as that would be committed to git…
Please help! New to Java and Maven too so might need to ELI5 if I’m missing something obvious. Copilot picked up my stack overflow question content and repeated it back to me when I asked
TIA!