I'm trying to run some pulseaudio operations with ProcessBuilder
in Java, e.g. pacmd list-source-outputs
on Ubuntu 18.04. When I run the code directly from Intellij it says No PulseAudio daemon running, or not running as session daemon.
However, if I go to build/classes/java/main and execute java MyMainClass
it works as expected.
I assume that it has something to with how the Intellij terminal is integrated. It doesn't seem to behave the same as the OS terminal (see image). Does anyone have more insights about the Intellij Terminal?
Process p = null;
try {
p = new ProcessBuilder("pacmd", "list-source-outputs").start();
printStream(p.getInputStream());
printStream(p.getErrorStream());
p.waitFor();
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
Edit: My Terminal settings: