0

how can I pass environment variables set in Java to another application, like CAD NX from Siemens. I know that AutoIT has the function, that if enviroment variables are set in the script and the application is launched from this script, the program uses the enviroment variables from the script as long as the script is running. The application automatically retrieves the variables and copies some files to another folder and so on...

How can I achieve this using Java? (I don't want to launch an external AutoIT script)

1 Answer 1

2

Use a ProcessBuilder. It has an environment() method which returns a (mutable!!) Map<String, String> representing the environment of the process you wish to run. Modifying this map modifies the environment of the process you will run.

See the javadoc (link above): it has an example altering the environment before running.

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

Comments

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.