Reputation: 717
There is a .jar program with a GUI. I want to run it inside my java program and be able to use its buttons (press buttons), compile text fields, select radio buttons, etc.. (always from my java program).
Is this possible?
Upvotes: 2
Views: 485
Reputation: 832
ProcessBuilder pb = new ProcessBuilder("java", "-Xmx1024m", "-Xms1024m",
"-DTOOLS_DIR=F://Net Beans Work Space//calc//dist", "-Daoi=whole",
"-jar", "F://Net Beans Work Space//calc//dist//calc.jar");
pb.start();
Use this code it will surely run your jar file what you have to change is the paths in above code please reply it will work for you I will be thankful for you kind reply
Upvotes: 2
Reputation: 68393
If you want to include its GUI in your parent program, then include this jar in your classpath and invoke its main program like any other method
if you want it to be executed separately, then you need to execute it like a command-prompt way,
java runtime.getruntime() getting output from executing a command line program
If you want it run separately, but still want data from it, then you need to ensure that you expose its API to external systems (accessible from it) either via RPC or web-service
Upvotes: 2