Is
Runtime.getRuntime().exec("cmd /c");
platform independent or I have to pass platform specific command in the parameter?
Thanks
What is the linux equivalent of the command cmd /c start /b java -jar
Runtime.getRuntime().exec() is platform independant in the way, that it will start an external executable on every platform. The executable itself has to be there of course, so starting notepad.exe on Linux will very likely not work (except when you have Wine and Notepad installed, but this is another story).
On Windows, enter anything you would enter into cmd.exe (details follow). But to do the automatic path lookup on Windows, you need to do something like
Runtime.getRuntime().exec("start iexplore.exe");
or
Runtime.getRuntime().exec("start my.pdf");
which opens the pdf file with the associated viewer.
On linux, you can do anything you would do in a shell like Bash, but you cannot use bash builtins like the pipe operator. You can just start programs and pass arguments.
To start another Java instance on linux you could use:
Runtime.getRuntime().exec(new String[] {"java","-jar","myjar.jar"});
Use the absolute path to the java executable if it is not on the PATH.