Print at Dec 21, 2025, 9:19:50 AM

Posted by treehousenorris2 at Sep 15, 2020, 6:42:24 PM
Re: Spawn Shell Process
Sweet Home 6.4.2 from SourceForge. To see the Sweet Home stdout I am using the dmg>app>executable because I wasn't able to get the Sweet Home jar to run from the terminal (not on mojave but worked on a catalina machine). Mojave only works by double clicking the Sweet Home jar, which defaults to open with Jar Launcher, but without stdout.

@Override
public void execute() {
routine();
}

public void routine() {
Process process;
try {
process = Runtime.getRuntime().exec(
new String[]{"bash", "-c", "pwd"},
null, new File("/bin"));
printResults(process);
} catch (IOException e) {
e.printStackTrace();
}
}

public void printResults(Process process) throws IOException {
BufferedReader reader = new BufferedReader(new
InputStreamReader(process.getInputStream()));
String line = "";
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
}