0

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 bash scripts to set a whole bunch of environment variables that are not predetermined within java.

Anyone know of an easy way to do this?

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I don't know how to do that? Where can I set BASH_ENV to ProcessBuilder? Is there any function?
0

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

1 Comment

Thanks for the tip on properties. Unfortunately its a bash (linux) script, so not properties format...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.