开发者

Setting a java ProcessBuilder environment with a bash script

开发者 https://www.devze.com 2023-04-03 20:01 出处:网络
I\'ve been using ProcessBuilder to successfully invoke a process with various environment variables using env.put(\"VAR\",\"value\").

I've been using ProcessBuilder to successfully invoke a process with various environment variables using env.put("VAR","value").

Now I'd like to source some bas开发者_C百科h scripts to set a whole bunch of environment variables that are not predetermined within java.

Anyone know of an easy way to do this?


bash supports the environment variable BASH_ENV on startup. Set the variable to your script and its contents will be sourced before execution. See bash(1) for details.


If your "batch scripts" to be sourced are in properties format, you can always load them using Properties and merge into the env.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号