Well, actually it does work! But if bash is not running interactively, it won't read the .bashrc where the shell-variables are stored. So I did the following:
sh.start("bash -i"); // the -i tell bash to run interactively if(sh.waitForStarted()) sh.write("printenv JAVA_HOME"); // or sh.write("echo $JAVA_HOME") sh.closeWriteChannel();In case you were wondering, I connected the QProcess::finished signal to a slot where the QProcess::readAllStandardOutput is put in a QPlainTextEdit.
The QProcess::processEnvironment is not updated however. Even if I try to export JAVA_HOME with sh.write("export JAVA_HOME"). While that is not what I expected, I now can find the local shell-variables.
So I will mark this problem as solved.
Thanks!