I am writing a platform independent Java console tool and within which will have to execute some commands in separate independent terminal at runtime.
However, I need to know which terminal should I be using gnome-terminal or xterm. i.e. the one available on that particular system. Since there are many different linux variants are available. I want to support at least the most obvious ones.
Normally in Java System.getProperty("os.name")
returns Linux
but it doesn't tell you if its Ubuntu or any other Linux varient. So It is difficult to know which terminal to start at runtime. Whether gnome-terminal or xterm or if there is anything else as well that I don't know.
Working sets:
In Windows:
cmd /c start java -jar jarTool arguments
In Ubuntu:
gnome-terminal --execute java -jar jarTool arguments
or
xterm -e java -jar jarTool arguments
Also just for additional information,I am using Runtime.getRuntime().exec(args or commands)
to start terminal from Java program at runtime.