2

In my Java application, I want to execute a python script with Process class. This python script needs to execute svn command. It seems that the PATH variable in my java application doesn't include /usr/local/bin. While I installed SVN 1.7.9 with homebrew and it's in /usr/local/bin. In the /usr/bin folder, there is another svn installed by xcode whose version is 1.6.x. This leads to a serious problem: when I execute the python script in my Java application, this script then executes svn in /usr/bin which is version 1.6.x. This version is too old to manage my working copy.

Is there any way to solve this problem?

1
  • You may want to use ProcessBuilder instead and set the PATH envionment in such a way that /usr/local/bin get picked first. See the example in the javadoc. Commented May 23, 2013 at 9:24

1 Answer 1

4

Either set the PATH environment variable before you launch your (parent) Java application, or use ProcessBuilder. The latter allows you to control what the child processes environment will contain via the Map object returned by the ProcessBuilder.environment() method.

(But note that you typically can't change the contents of the child processes environment once it has been started ...)

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.