I want run another application from java code.
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec("cmd.exe");
Process is launched, but in background. How to make it run in foreground?
Process#waitFor() is what you're looking for.
You should tell cmd.exe that you want it to open in new window:
Process pr = rt.exec("cmd.exe /c start");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With