0

I tried open a command prompt using java program, how to execute the some exe file in this command prompt using java code.

1 Answers1

3

Runtime.getRuntime().exec() or using ProcessBuilder.

Now, if you want to open command prompt on windows run pass "cmd.exe" to exec() method. You have to find which command to run for each other OS your application is targeted for.

AlexR
  • 114,158
  • 16
  • 130
  • 208