0

I am trying to set an environment variable using a java code. When i run this java code from the bash, I want to echo the environment variable that i set in the java program. How can this be done

0

If you're talking of something like this:

$ java Foo
$ echo ${var_set_by_foo}

This cannot be done. A process cannot affect another's environment, and a Java program is perforce run as a separate process from your shell.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.