I started a project in Processing and then found that I needed more functionality. I had the following function that worked fine in Processing but now in the java environment I am getting an error.
Function:
void camSummary() {
System.out.format("Cam summary");
String commandToRun = "./camSummary.sh";
File workingDir = new File(main.path);
try {
Process p = Runtime.getRuntime().exec(commandToRun, null, workingDir);
int i = p.waitFor();
if (i==0) {
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ( (returnedValues = stdInput.readLine ()) != null) {
System.out.format(returnedValues);
}
}
}
catch(Throwable t) {
System.out.format("error: " + t + "\n");
}
}
Error:
Cannot run program "camSummary.sh" (in directory "/Users/lorenzimmer/Documents/RC/CamSoft/ "): error=2, No such file or directory
I've found that there have been some very slight differences from processing to java. I'm wondering if this function just needs to be tweaked slightly to run properly.
Any help would be greatly appreciated.
Loren
/Users/lorenzimmer/Documents/RC/CamSoft/camSummary.shactually exist?workingDir. It actually looks for the script in the working directory of the java application itself. It just executes the script from theworkingDirpath. So put your script relative to the working directory of the java application.commandToRun. Already tried to remove them?