Reputation: 29
I want to be able to run a separate jar file, and be able to display any output from its console, and be able to send input. I want to be able to create a console which will act like the console in windows 7, but look better.
Upvotes: 2
Views: 68
Reputation: 421080
You can use ProcessBuilder
to launch java -jar yourprogram.jar
as follows:
Process p = new ProcessBuilder("java", "-jar", "yourprogram.jar").start();
To deal with input / output of this process, you can follow this post:
Upvotes: 1
Reputation: 2260
After finishing your code , create jar file output (It depends on which IDEA you are working on)
then you can use java -jar JarFileName.jar
in order to run the jar file,
Note that JDK path should be defined in system environment to use java -jar
command,
Upvotes: 0