Matt Matt - 4 months ago 14x
Java Question

Open a new prompt/terminal window from Java

I want to open a new terminal window, which will run a certain command upon opening. It preferably needs to be a real native window, and I don't mind writing different code for linux/osx/windows.

I'm assuming an emulated terminal would work, as long as it supports everything a real terminal would do and isn't just printing lines of output from a command.


Opening an actual terminal window will definitely require different code for each OS. For Mac, you want something like:

Runtime.getRuntime().exec("/usr/bin/open -a Terminal /path/to/the/executable");