Execute a jar in separate console(command prompt/terminal) from another java application

292 views Asked by At

I've created a jar using warbler from ruby code. When I execute it using "java -jar rubyapp.jar" on console (command prompt/terminal), it executes successfully and gives me pry prompt. Now I want to execute this application from Java Gui Application and want to have pry/irb prompt at where I can execute commands. I've tried below code snippets but somehow it doesn't open console or have a pry/irb prompt.

Runtime.getRuntime().exec("cmd /c start rubyapp.jar");

Runtime.getRuntime().exec("java -jar rubyapp.jar");

Runtime.getRuntime().exec("cmd /c java -jar rubyapp.jar");

String[] commandArray = ["java", "-jar", "rubyapp.jar"];
Runtime.getRuntime().exec(commandArray);
0

There are 0 answers