Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Scripts don't see ROS if executed by ProcessBuilder()

I want to execute a script with a ProcessBuilder(). My code is:

new ProcessBuilder().inheritIO().command("/bin/bash", "-c", "./").start();

In the bash script I have:

rosrun my_package

It works if I run the bash script manually in the terminal, but if I do with the ProcessBuilder I got an error:

rosrun: command not found

The same if I run python scripts which uses ROS. There are errors that some package are not found, whereas it works fine if run via terminal.