Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (13.1k points)
Can anyone help me how I can able to set the environment variables in Java? Is it possible to set environment variables for the running processes?

1 Answer

0 votes
by (26.7k points)

You can use the below method to do that:

void setUpEnvironment(ProcessBuilder builder) {

    Map<String, String> env = builder.environment();

    // blah blah

}

Also, if your sub-processes are the same, then you don't need to go through this setup multiple times.

I hope this will help.

Want to become a Java Expert? Join Java Course now!!

Want to know more about Java? Watch this tutorial on Java Tutorial for Beginners | Java Tutorial:

Related questions

+1 vote
1 answer
0 votes
2 answers
0 votes
1 answer

Browse Categories

...