Matt Matt - 1 year ago 144
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.

Answer Source

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");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download