3 ms·
Sure is painful (mostly when writing tests where the environment variables aren't abstracted in some way). But I think it was actually possible to hack around
by jamesfinlayson 2y ago
Sure is painful (mostly when writing tests where the environment variables aren't abstracted in some way).
But I think it was actually possible to hack around up until Java 17.
- xxs 2y agoif you really wish - you can change the bootstrap path and allow changing env() for whatever reason you want to (likely via copy on write). If you don't wish to do that feel free to spawn a child process with whatever env you desire, then redirect/join sys in/our/err (0/1/2) Those are trivial things in around 100 lines of code and have been available since System.getenv() got back (it used to be deprecated and non-functional prior Java 1.5 or 2004)
- jamesfinlayson 2y agoA lot of the Java I'm writing is in AWS Lambda so my options are a bit more limited.