1. ProcessBuilder is the preferred mechanism for running an external process in Java (introduced in 1.5).
2. External process tend to fail/hang if you do not explicitly handle the standard output/error streams.
From: starcluster-bounces_at_mit.edu [mailto:starcluster-bounces_at_mit.edu] On Behalf Of Andrea La Rizza
Sent: Monday, April 27, 2015 9:36 AM
Subject: [StarCluster] EXECUTE STARCLUSTER FROM JAVA CODE
I'm creating a complex project, and what I want to do is to launch the command "starclster start my custer" by pressing a button in a java swing interface.
I have created a script called run with the command inside, and what I do in my java cose is:
String cmd = new String;
cmd = "sh";
cmd = "run";
// create runtime to execute external command
Runtime rt = Runtime.getRuntime();
//Process pr = rt.exec("/path/to/script/run");
Process pr = rt.exec(cmd);
If I run the script from shall it works, i i press the button nothing happens. Is there someone that have done something similar? Thanks.
StarCluster mailing list
Received on Mon Apr 27 2015 - 13:23:59 EDT